Hello,
I am trying to read out custom email properties which are stored as NamedProperty in PS_PUBLIC_STRINGS.
Im am using the following code:
//Get CUSTOM PROPERTY from email
PropertyDescriptor propertyDescriptor = new PidNamePropertyDescriptor("AsposeTestCustomProp",
PropertyDataType.String,
KnownPropertySets.PublicStrings);
List<PropertyDescriptor> propertyDescriptors = new List<PropertyDescriptor>();
propertyDescriptors.Add(propertyDescriptor);
MailMessage mailMsg = ewsClient.FetchMessage(exchangeMessageInfo.UniqueUri, propertyDescriptors);
var mapi = MapiMessage.FromMailMessage(mailMsg);
foreach (var namedProp in mapi.NamedProperties)
{
Console.WriteLine($"{namedProp.Value.Name}={namedProp.Value.GetString()}");
}
This does not seem to work - the properties are not available.
Second step was to try with an email from File ; which I have saved from Outlook [MYPROP.zip (12.9 KB)]. Note that The NamedProperty MYPROP was added with OutlookSpy
static void FromFile()
{
MailMessage mail = MailMessage.Load(@"C:\temp\MYPROP.msg");
var mapi = MapiMessage.FromMailMessage(mail);
foreach (var namedProp in mapi.NamedProperties)
{
Console.WriteLine($"{namedProp.Value.Name}={namedProp.Value.GetString()}");
}
}
Result = NO NamedProperties available (same as from Exchange email)/
Note that the sample from Aspose “ReadNamedMAPIProperties” also doens’t return any results.
I opened the sample email in “message.msg” with OutlookSpy and it looks like this sample does not contain the property MYPROP and/or TEST? Do we need to add it from code to be able to run the test? Or is there an issue with the Aspose version I am using?
I am using version 17.10.0 (from NUget)