Event on “Item Sent” in Outlook

后端 未结 1 1143
無奈伤痛
無奈伤痛 2021-01-05 07:14

I\'m using ApplicationEvents_11_ItemSendEventHandler (see http://msdn.microsoft.com/en-us/library/microsoft.office.interop.outlook.applicationevents_11_itemsend

相关标签:
1条回答
  • 2021-01-05 08:09

    If you use a modal dialog (WPF/Winforms MessageBox), you will only get the first event trigger. You must implement a non-blocking event handler (possibly an item queuing strategy).

    Don't use the blocking UI call modal dialogs - Outlook will notice the UI is blocked and ignore triggering subsequent interrupts.

    See this form post for reference.


    If you are worried about the users preferences for controlling Sent Item storage, just override them using the following snippet...

    MailItem.DeleteAfterSubmit = false; // force storage to sent items folder (ignore user options)
    Outlook.Folder sentFolder = ThisAddIn.Application.Session.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderSentMail);
    if (sentFolder != null)
        MailItem.SaveSentMessageFolder = sentFolder; // override the default sent items location
    MailItem.Save(); 
    
    0 讨论(0)
提交回复
热议问题