1
votes

I have created an Outlook add-in. When any mail is opened/previewed in Outlook, I want my add-in to update the body of the mail. And when the mail is closed or the preview is closed, I want the changes to be reverted back to the original changes.

For this I have tracked the SelectionChange event. Inside its handler:

  1. I have obtained the Active Explorer using mApp->ActiveExplorer(&mExplorer) function
  2. Then obtained selection from explorer using mExplorer->get_Selection(&lSelection)
  3. Then obtained the mail item from Selection using QueryInterface()
  4. On this mail item, I am updating the body using put_HTMLBody() function

Now, when the user clicks on any other mail, I want to discard the changes I made. However, the mail item gets saved and Outlook also creates another mail as well.

I want to discard the changes in all cases like if the user double clicks and opens the mail and closes it.

How can I discard the changes made to any mail item?

1

1 Answers

0
votes

Don't do that. Temporary changing anything in Outlook never works well. If you want to display your own data, display it in your own control / custom form /etc.