Search code examples
vstooutlook-addin

Outlook Add In : Is it possible to discard changes to a mailItem programatically ?


I have created an outlook add in which modifies the attachment and the body of the message when the user opens the mail. However, whenever I close the window , there is a prompt which asks me if I want to save the changes made to both the attachments and the properties of the message.

What I would like to ask is that , is there any way for me to discard the changes programatically so that the mail will return to the state before I opened it ?

I have also used Marshal.ReleaseComObject(_mailItem); , but the prompt still appears .


Solution

  • Try to call mailItem.Close(OlInspectorClose.olDiscard);.