Get MessageID of a sent mail in Outlook

emailoutlookoutlook-addinvsto

I'm currently writing on an Outlook VSTO AddIn. Using this AddIn, I would like to keep track of E-Mail conversations and be able to uniquely identify mail messages. We are using Exchange as MTA.

For all the mails in the Inbox (and many other folders) I can use the Message ID from the mail's header to do the matching, but mails lying in the "Sent Items" folder do not have a Message ID set.

Is there a way to get the Message IDs from those mails?

(I guess that the mails do not have a header, as they are placed in the folder before being sent; but after sending the mail, the MTA gives a message with status code 250 which contains the Message ID.) Does Outlook know about or somehow save the MessageID? How can Outlook keep track of conversations, if it doesn't know the MessageID?
Is there another way to identify a mail?

Best Answer

First let us clarify why do you mean by

Is there another way to identify a mail

Actually you can duplicate an email then, they will have the same MessageID but different ItemId. If you have multiple recipients: toms@gmail.com, toms@an.exchange.mailbox.com, toms2@an.exchange.mailbox.com they will have the same MessageID (aka InternetMessageId) even the first one is not even Exchange. For the two others, there are two different messages within the same Exchange server. The have differents ItemID(aka EntryId).

Conclusion, the MessageID identifies the mail from its content and is set by the mailserver sending the email. To my knowledge there is no alternative (except creating your own "digest") from the immutable properties of an email. Keep also in mind that 'ItemId' changes when you move an email from a folder to another. See

For a VSTO add-in you can retrieve the MessageID aka InternetMessageId using Redemption. The other alternative is to ask the ExchangeServer using MAPI or EWS. In all cases there will be a 'server call' and it cannot be retrieve directly after sending because this property is set by Exchange Mail server.

Related Topic