user1926691
user1926691

Reputation: 173

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 .

Upvotes: 2

Views: 1183

Answers (1)

Dmitry Streblechenko
Dmitry Streblechenko

Reputation: 66276

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

Upvotes: 1

Related Questions