In an add-in for Outlook 2010, how can I delete a delete operation?

I am writing an add-in for Outlook 2010. At some point, he needs to delete the mail items selected by the user. I am using the following code that works quite well:

Selection selectedMessages = Globals.ThisAddIn.Application.ActiveExplorer().Selection;

// It is possible for a non-mail item to be part of this collection.  (One example is when a calendar
// item is in the deleted items folder.  Select it and hit this delete button.)
System.Collections.IEnumerator enumerator = selectedMessages.GetEnumerator();
while(enumerator.MoveNext())
{
  if (enumerator.Current is MailItem)
  {
    ((MailItem)(enumerator.Current)).Delete();
  }
}

My problem is that when I delete messages in this way, the usual cancel operation is not available to the user. The user can go to the Deleted Items folder and move the messages back to the Inbox. But this will be confusing for users who are accustomed to simply pressing Ctrl-Z or the small "Cancel" arrow in the upper left corner of the screen.

- Undo , , "" Outlook , ?

+3
1

MailItem; olFolderDeletedItems. GetDefaultFolder() ; . .

+1

Source: https://habr.com/ru/post/1791304/


All Articles