In our MAPI message store provider, we present both email and non-outlook items (office documents etc). Technically, we provide these documents as an IMessage object with a single attachment and a specific PR_MESSAGE_CLASS
(e.g. IPM.Document.txtfile) . Outlook then considers this object to be a DocumentItem
, not a MailItem
.
As you can see in the screenshot below, this works fine. Previewer works as expected, double clicking the item will open the item in the appropriate application (e.g. Notepad).
However, after the item has been opened, once the external application closes, something goes amiss. The preview breaks, and the item can not be opened again until another item is selected first.
According to Outlook Spy, our IMessage
object is still perfectly fine. It is the OOM DocumentItem
wrapper that is now somehow missing it's attachment:
What could be causing this behavior? Is there a refresh we are missing? Is the Outlook item presenting an old IMessage object that has gone corrupt? We've spend quite a bit of research on this topic already, all pointers are welcome!
[EDIT 1]
Here is Outlook spy stating our IMessage
object is still ok:
[EDIT 2]
As long as the external application doesn't close, everything is fine. I can open the document as many times as I want, but as soon as I close a single instance of the external viewer the Outlook item gets "corrupted".