Read NamedProperty from email (from Exchange) doesn't work

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)

@Luk_De_Reu,

We have reworked retrieval of properties from Exchange Message and this will be available in upcoming version of Aspose.Email for .NET 17.11 which is due for release by mid of this month.

At present, you will not find the NamedProperty while using MapiMessage.FromMailMessage. However, you can retrieve the property information from file using MapiMessage.FromFile. Please let us know if we can be of any additional help to you in this regard.

Hello,

Thanks for the prompt response. I will test with the new version as soon as it is available.
Thanks.

You are welcome.

Hello,

I tested with the last version (7.11), sadly this issue is not resolved…

@Luk_De_Reu,

Could you please share with us if you have tried retrieving properties from file or Exchange server? Please share exact code sample if it is different from above.

Hey Kashif,

The email is read from the Exchange server (Office 365).
I notice it is possible to read the properties from file when the email is saved from Outlook.

The use case is there is an Outlook Add-in / App which stored custom properties in the email which need to be read out from the mailbox using aspose. Note that when the email is stored to disk first with aspose the properties are not there; they only seem to be available is the email is saved by using Outlook…

@Luk_De_Reu,

This recent version of Aspose.Email for .NET has introduced new method, FetchMapiMessage, using the IEWSClient that lets you download message in Outlook MSG file format along with the Extended Attribute values. Please try it at your end and let us know your feedback.

Thanks - this works! Great support.

@Luk_De_Reu,

You are welcome.