cancel change in email

Add-in Express™ Support Service
That's what is more important than anything else

cancel change in email
cancel change in email 
Karim




Posts: 170
Joined: 2006-01-02
Hi,
I use this code in a ribbon button to cancel my changes. it works well but if the message is open it closes the window.
how to cancel changes without the message window closing



//...
        try
          sel := OutlookApp.ActiveExplorer.Selection;
          except
        end;

        if sel <> nil then
        begin
          Item := sel.Item(1);

          Item.QueryInterface(IID__MailItem, IMail);
          if IMail <> nil then
            begin
             IMail.Close(olDiscard);

             IMail := nil;
             Item  := nil;
            end;
         end;


//...
Posted 30 Apr, 2018 04:58:44 Top
Andrei Smolin


Add-in Express team


Posts: 18806
Joined: 2006-05-11
Hello Karim,

Your code closes the mail item discarding all changes. There's no way to leave the inspector window open after executing that code line.


Andrei Smolin
Add-in Express Team Leader
Posted 30 Apr, 2018 05:44:48 Top
Karim




Posts: 170
Joined: 2006-01-02
Hello Andrei,
thanks for the answer. I have another question, I did several tests and it is not possible to make a memory copy of an email make a modification of this email without changing the original. is this normal? Is there a way to work only on the copy without altering the original ?
Posted 30 Apr, 2018 05:54:40 Top
Andrei Smolin


Add-in Express team


Posts: 18806
Joined: 2006-05-11
Karim,

To create a copy of an email, call MailItem.Copy(). Note that this call creates another email; the latter is visible in Explorer windows.


Andrei Smolin
Add-in Express Team Leader
Posted 30 Apr, 2018 06:04:27 Top
Karim




Posts: 170
Joined: 2006-01-02
I tested this method, but I do not want it to be visible in Explorer windows.
Posted 30 Apr, 2018 06:45:14 Top
Andrei Smolin


Add-in Express team


Posts: 18806
Joined: 2006-05-11
The Outlook object model doesn't provide a way to bypass this issue.


Andrei Smolin
Add-in Express Team Leader
Posted 30 Apr, 2018 07:35:29 Top