Platform SDK: CDO 1.2.1 |
The Fields property returns a single Field object or a Fields collection object. Read-only.
objMessage.Fields
objMessage.Fields(index)
objMessage.Fields(proptag)
objMessage.Fields(name)
Object (Field or Fields collection)
The Fields property returns one or all of the fields associated with a Message object. Each field typically corresponds to a MAPI property. Data types are preserved, except that MAPI counted binary properties are converted to and from character strings representing hexadecimal digits.
The Fields property provides a generic access mechanism that allows Microsoft® Visual Basic® and Microsoft® Visual C++® programmers to retrieve the value of a MAPI property using either its name or its MAPI property tag. For access with the property tag, use objMessage.Fields(proptag), where proptag is the 32-bit MAPI property tag associated with the property, such as CdoPR_PRIORITY. To access a named property, use objMessage.Fields(name), where name is a string that represents the custom property name.
Although the Fields property itself is read-only, the collection it returns can be accessed in the normal manner through its Add and Delete methods, and the properties on its member Field objects retain their respective read/write or read-only accessibility.
The Fields property does not correspond to a MAPI property and cannot be rendered into HTML hypertext by the CDO Rendering Library.
' get the message’s Fields collection Set objFieldsColl = objOneMsg.Fields ' get the first field of the Fields collection of the message i = 1 Set objOneField = objFieldsColl.Item(i) ' could also be objFieldsColl(i) since Item is default property If objOneField Is Nothing Then MsgBox "error; cannot get this Field object" Else MsgBox "Selected Field " & i End If