Question

Is there a way of creating an RDOMail instance for a MailItem corresponding to an Outlook message opened from a .msg file?

My usual approach is to get the CurrentItem from the Inspector, cast it to MailItem, retrieve its EntryID and StoreID values, and finally load it from an RDOSession through the GetMessageFromID method.

However, in the case of messages opened from a .msg, the EntryID property returns null. Is there another way around this? I assume I could use the GetMessageFromMsgFile method instead, but how do I retrieve the full path of the message from the MailItem?

P.S. The solution should ideally work with the Outlook 2003 object model.

Was it helpful?

Solution

You could do two approaches here...

  1. Save the MailItem to disk using _MailItem.SaveAs(). Then use GetMessageFromMsgFile.
  2. Save the MailItem to a Folder (store) to persist it, giving it an EntryID and StoreID. Use MailItem.Save() and MailItem.Move(tempFolder) to persist the MSG to a folder. I typically use a hidden folder for this storage swap. You would need to periodically purge this swap folder on startup or at regular intervals (Outlook has lingering locks, so you better use try/catches).
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top