Wednesday, 24 February 2010

retrieve emails as plain text from exchange webservices

basically create a new propertyset with the schema you need to retrieve, and then set the 'RequestedBodyType' of the 'propertyset' to 'BodyType.Text'

code example:

PropertySet myPropertySet = new PropertySet(
ItemSchema.Importance,
ItemSchema.Subject,
ItemSchema.Body,
ItemSchema.DateTimeReceived,
ItemSchema.HasAttachments,
EmailMessageSchema.From,
EmailMessageSchema.ToRecipients,
EmailMessageSchema.DisplayTo

);
myPropertySet.RequestedBodyType = BodyType.Text;
service.LoadPropertiesForItems(findResults.Items, myPropertySet);

foreach (Item myItem in findResults.Items)
{
//etc
}