Howto: Example to retrieve the html body property of a message using the Exchange Managed API.
public string GetMessageBodyAsHtml(Item oItem)
{
string sRet = string.Empty;
PropertySet oPropSet = new PropertySet(PropertySet.FirstClassProperties);
oItem.Load(PropertySet.FirstClassProperties);
PropertySet oPropSetForBodyText = new PropertySet(PropertySet.FirstClassProperties);
oPropSetForBodyText.RequestedBodyType = BodyType.HTML;
oPropSetForBodyText.Add(ItemSchema.Body);
Item oItemForBodyText = Item.Bind((ExchangeService)oItem.Service, oItem.Id, (PropertySet)oPropSetForBodyText);
oItem.Load(oPropSetForBodyText);
sRet = oItem.Body.Text;
return sRet;
}
Comments
- Anonymous
January 10, 2016
Nice, it worked for med!!!