2
votes

I'm trying to match an outlook "draft" with its corresponding outlook "sent email" after the draft is sent, but it doesn't seem like I'm getting anywhere.

I've tried using the ConversationId and this almost worked. A draft can be matched to a sent email through the ConversationId, but the problem is that a user can create 2 different drafts and thus break this logic (as the 2 drafts will have the same ConversationId and thus cannot be uniquely identified to the sent email.

I've tried using the EntryId property, but of course, it's different on the draft than on the sent email. I've tried seeing if the parent EntryId to see if anything could be filtered out, but that didn't worth either.

I've dug deeper into the MAPI and found PR_INTERNET_MESSAGE_ID_W but that doesn't exist on the draft.

In essence (sorry for the rambling), my question is how do I uniquely identify an outlook draft to its associated sent email (after the draft is sent)?

1

1 Answers

2
votes

You can use PR_SEARCH_KEY - but it can change (see https://blogs.msdn.microsoft.com/stephen_griffin/2009/12/14/pr_search_key-and-draft-messages/). PR_RECORD_KEY as well as PR_ENTRYID are changed when copied.

Why not set your own named property using MailItem.PropertyAccessor.SetProperty? Just don't use MailItem.UserProperties as that can cause the message to be sent in the TNEF format.