'How does Outlook know if an MSG file has been sent?

If you start writing an email in Outlook and drag it from Drafts to your desktop, Outlook will open it with the Send button available and all fields modifiable.

Likewise, if you drag a received email to your desktop, Outlook will open the MSG file in read-only mode.

I am hoping to add a feature in my c# application which can read a sent MSG file and then write it back in draft mode. So far I haven't had much luck finding any information on this.



Solution 1:[1]

Outlook looks at the MSGFLAG_UNSENT bit in the PR_MESSAGE_FLAGS MAPI property (you can see it in OutlookSpy - I am its author - click IMessage button for a message in one of the Outlook folders or OpenIMsgOnIStg button in case of a standalone MSG file).

Outlook would not let you modify that flag - MailItem.Sent property is read-only. Moreover, that bit can be set (if you are using Extended MAPI in C++ or Delphi) only before the message is saved for the very first time. That limitation does not apply to the standalone MSG file - MSGFLAG_UNSENT bit can be set or unset at any time.

If using Redemption (I am also its author) is an option, its RDOMail.Sent property is read-write. To open a standalone MSG file, you can use RDOSession.GetMessageFromMsgFile method (returns RDOMail object) - you can then modify the Sent property and call RDOMail.Save.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1