Hi Guys,
I have the followed code that uses Microsoft’s Exchange Web Services api. It connects to exchange, pulls a mail message given a specific ID and reads two custom properties.
I need to be able to accomplish the same thing with Aspose.
I CAN get it to load the mail message from Exchange using your API but I cannot work out how to pull the properties.
Can you please advise me how to convert the code below to read the properties?
public class MailPropertyNames { public const string TagsPropertyName = "ResearchEmailTags"; public const string EffectiveDatePropertyName = "ResearchEmailEffectiveDateyyyyMMdd"; } ************ var service = new ExchangeService(ExchangeVersion.Exchange2010_SP2) {UseDefaultCredentials = true}; service.AutodiscoverUrl(_mailbox); var mail = EmailMessage.Bind(service, new ItemId(id)); var msg = new Emails.Domain.Model.EmailMessage(); msg.Id = id; var tags = string.Empty; var propDefinition = new ExtendedPropertyDefinition(DefaultExtendedPropertySet.PublicStrings, MailPropertyNames.TagsPropertyName, MapiPropertyType.String); mail.Load(new PropertySet(BasePropertySet.FirstClassProperties, propDefinition)); mail.TryGetProperty(propDefinition, out tags); msg.MacroTags = tags; var effectiveDateStr = string.Empty; DateTime effectiveDate; propDefinition = new ExtendedPropertyDefinition(DefaultExtendedPropertySet.PublicStrings, MailPropertyNames.EffectiveDatePropertyName, MapiPropertyType.String); mail.Load(new PropertySet(BasePropertySet.FirstClassProperties, propDefinition)); mail.TryGetProperty(propDefinition, out effectiveDateStr); if (!string.IsNullOrEmpty(effectiveDateStr)) if (DateTime.TryParseExact(effectiveDateStr, "yyyyMMdd", new CultureInfo("en-GB"), DateTimeStyles.AssumeLocal, out effectiveDate)) msg.EffectiveDate = effectiveDate;
Many thanks,
James