How can I retrieve properties such as ConversationIndex/Thread-Index through Exchange Mail

Using the example in Working with Exchange Mailbox and Messages - Read Email from Exchange Server in C#|Documentation, how can one retrieve these MAPI properties? The properties exist in Microsoft Exchange (other tools can access them). Even after the call to client.FetchMessage(strMessageURI), it is not clear how to access these properties.

Hi Tamayi,


Thank you for posting your inquiry.

The IEWSClient has overloaded member of FetchMessage(UniqueUri, ExtendedProperties) that can fetch the additional information as well from the server while fetching a message. Could you please share some sample software name that we can use to analyze these properties in the some test message? I have downloaded a sample message from MS Outlook and it doesn’t show this property in the list of properties. We shall look into it and assist you further.

Where can I get documentation how to use that overload of the FetchMessage(UniqueUri, ExtendedProperties). The documentation I can find here

[http://www.aspose.com/docs/display/emailnet/Aspose.Email.Exchange.ExchangeClient.FetchMessage+Method ](http://www.aspose.com/docs/display/emailnet/Aspose.Email.Exchange.ExchangeClient.FetchMessage+Method) does not mention how I can use this overload. What values can I pass in as the ExtendedProperties?

Other libraries

The EWS Managed API library has a Microsoft.Exchange.WebServices.Data.EmailMessage class which exposes a property byte[] ConversationIndex and string ConversationTopic which allow getting these properties. (See https://msdn.microsoft.com/en-us/library/microsoft.exchange.webservices.data.emailmessage_members(v=exchg.80).aspx )

Additionally, in an Outlook VSTO addin, the MailItem class also exposes these properties (See https://msdn.microsoft.com/en-us/library/microsoft.office.interop.outlook.mailitem_members.aspx )

Hi Tamayi,

Thank you for providing additional information. Thread index can be retrieved from the message headers as shown in the following sample code. Could you please give it a try and let us know the feedback?

IEWSClient client = GetAsposeEWSClientTest3();
ExchangeMailboxInfo mailboxInfo = client.GetMailboxInfo();
ExchangeMessageInfoCollection msgInfoColl = client.ListMessages(mailboxInfo.InboxUri);

foreach (ExchangeMessageInfo emi in msgInfoColl)
{
    MailMessage msg = client.FetchMessage(emi.UniqueUri);
    
	if (msg.Headers["Thread-Index"] != null)
        Console.WriteLine("Thread-Index = " + msg.Headers["Thread-Index"]);
    if (msg.Headers["Thread-Topic"] != null)
        Console.WriteLine("Thread-Topic = " + msg.Headers["Thread-Topic"]);
}