How to get item properties from ExchangeMessageInfo objects

I’m using IEWSClient.ListMessages Method (String, ExchangeListMessagesOptions, IEnumerable) to retrieve a collection of messages including properties. How do you get the property values from the results? I notice that the ExchangeMessageInfo objects have the values in the non-public members, but how do I get at them?

image.png (26.1 KB)

@rapperson-1,

Could you please share such a test message with us on this test email: UserOne@AsposeJun2018.onmicrosoft.com? This will help us look into it for assisting you further?

PS: Aspose.Email API lets you fetch message from server as MapiMessage having all extended attributes information. Please have a look at it and let us know if it is what you are looking for.

Kashif Iqbal, thanks for your reply. Any message stored in an MS Exchange mailbox will work because I’m trying to get the EntryID value (Pid 4095) which every message has. Here is some sample code. Note: the last line is what I would like to be able to do, but obviously it doesn’t work. Based on the screenshot I included in this post, the data is there, it’s just private for some reason.

            var entryIdPropDescriptor = new PidTagPropertyDescriptor(Convert.ToInt32(4095), PropertyDataType.Binary);
            var contactInfos = client.ListMessages(client.MailboxInfo.CalendarUri, ExchangeListMessagesOptions.None, new[] { entryIdPropDescriptor });
            var c1 = contactInfos.First();
            var entryIDBytes = c1.SubStorages.Values.FirstOrDefault((val) => val.Identifier == 4095).Data;

I cannot use fetch message due to the bug (EMAILNET-39009).

@rapperson-1,

Unfortunately, we re not able to get hold of such information in messages available at our end. However, you can get Entry ID for messages using the following sample code for messages:

var msg = client.FetchMapiMessage(msgsInfos[0].UniqueUri, new[] { KnownPropertyList.EntryId });

Console.WriteLine(msg.Properties[MapiPropertyTag.PR_ENTRYID]); 

For EMAILNET-39009, the issue has been fixed and the upcoming release of Aspose.Email for .NET 18.6 will include the fix for this issue. We’ll notify you here once the fix version is available for download.

“Unfortunately, we re not able to get hold of such information in messages available at our end.” – but that’s not true, as shown in the photo I provided. It’s there but just in a private field (dictionary).

@rapperson-1,

Please check: https://i.imgur.com/5yiKeZ4.png

We sent a normal email message to the test account and the resultant didn’t contain any such information.

Did you use the four lines of code I posted above? You need to include the property descriptor for the EntryID tag (4095) in the call to ListMessages. EntryID is a built-in, native value that all Exchange messages have.

@rapperson-1,

The ExtendedProperties collection of ExchangeMessageInfo is private by design. A ticket with id: EMAILNET-39027 has been logged for looking into possibility to make it Public. We’ll update you here as there is some information or a fix version available in this regard.