Email properties and elements in EWS in Exchange
Learn about the first-class and other properties and elements that you can get on email messages by using the EWS Managed API or EWS in Exchange.
Email messages have more than 50 properties, and getting the ones you want, when you want them, can be confusing if you don't know where to look. The most important thing to know about working with email properties and elements is which are included in the set of first-class properties and elements that is returned by each of the main retrieval methods and operations. The set of first-class properties that is returned varies based on the retrieval method that you use. It's also important not to be fooled by the AllProperties value of the BaseShape EWS element, which corresponds to the BasePropertySet.FirstClassMessageProperties enumeration value in the EWS Managed API. This value doesn't actually include all properties, it only includes the first-class properties.
First-class properties and elements for email messages
The set of first-class properties and elements that are returned by the EWS Managed API EmailMessage.Bind method and the EWS GetItem operation is slightly different than the set of first-class properties and elements that is returned by the EWS Managed API ExchangeService.FindItems method and the EWS FindItem operation. The first-class properties returned by the FindItems method and FindItem operation are a subset of the properties returned by the Bind method and GetItem operation. Table 1 lists all the first-class properties returned by the Bind method and the GetItem operation, and specifies which of those are not returned by the FindItems method or FindItem operation. Note that you cannot extend the FindItems method or the FindItem operation to retrieve additional properties and elements such as ToRecipients, CcRecipients, and BccRecipients. If you need to retrieve those values, use the FindItems method or the FindItem operation to get the item IDs of the emails, and then use the Bind method or the GetItem operation, to retrieve the required properties. For code examples that show how to retrieve items by using the Bind or the FindItems method, see Get an item by using the EWS Managed API. For code examples that show how to retrieve items by using the GetItem or FindItem operations, see Get an item by using EWS.
The first-class properties and elements are listed in the following table in the order in which they appear in a response.
Table 1. First-class email properties and elements
Other properties and elements for email messages
Not all important email properties and elements are first-class properties and elements. To get the other properties or elements, you need to add them to your PropertySet if you're using the EWS Managed API, or use a property path to add them to your EWS operation call. For example, to retrieve the text body and the MIME content of a message, create your PropertySet as shown for the Bind or Load method.
PropertySet(BasePropertySet.IdOnly, ItemSchema.TextBody, ItemSchema.MimeContent);
Or if you're using EWS, add the elements to the AdditionalProperties element in your GetItem operation request, as shown.
<t:AdditionalProperties>
<t:FieldURI FieldURI="item:TextBody" />
<t:FieldURI FieldURI="item:MimeContent" />
</t:AdditionalProperties>
EmailMessage properties inherited from the EWS Managed API ServiceObject object cannot be included in a property set for the Bind method; however, all the ServiceObject properties are readable on the EmailMessage object and are retrieved by the Bind method.
Table 2. Other email properties and elements
EWS Managed API property | EWS element | Read-write or read-only |
---|---|---|
ArchiveTag |
ArchiveTag |
Read-write |
ExtendedProperties |
ExtendedProperty |
Read-only |
IconIndex |
IconIndex |
Read-only |
IsAttachment |
Not available |
Read-only |
IsDirty |
Not available |
Read-only |
IsNew |
Not available |
Read-only |
Item |
Item |
Read-only |
MimeContent |
MimeContent |
Read-only |
Not available |
MimeContentUTF8 |
Read-only |
NormalizedBody |
NormalizedBody |
Read-only |
PolicyTag |
PolicyTag |
Read-write |
Preview |
Preview |
Read-write |
RetentionDate |
RetentionDate |
Read-only |
Schema |
Not available |
Read-only |
Service |
Not available |
Read-only |
StoreEntryId |
StoreEntryId |
Read-only |
TextBody |
TextBody |
Read-only |
UniqueBody |
UniqueBody |
Read-only |