none
How to detect shutdown of Outlook Add-In if Outlook was started by another Application RRS feed

  • Question

  • Hi,

    we have a problem with our Outlook Add-In in a special scenario. (We use Add-In Express!)

    In this scenario Outlook is closed. Use Excel (for example) to send an Email (File -> Share -> E-Mail). An Outlook Inspector will be openend. In our Addin the AddinModule_AddinStartupComplete method will be called. But after closing the Inspector the AddinModule_AddinBeginShutdown method won't be called. Also the AddinModule_AddinFinalize method and the adxOutlookEvents_Quit method won't be called.

    Do you know how to detect the Quit event in this special scenario in our Add-in?

    If you use the send button of the inspector the Quit event will be raised!

    Best regards
    Arkadius

    Tuesday, July 2, 2013 1:03 PM

Answers

  • When you get the startup event check for Explorers.Count and Inspectors.Count. If there is any UI at all add event handlers for the open Explorer and/or Inspector. When those events fire check to see if any other UI is present. If not, Outlook is going to close.

    Another option, which I usually use as a fallback, would be to directly add an event handler to an instance of the Outlook.Application object for Application.Quit().


    Ken Slovak MVP - Outlook

    Tuesday, July 2, 2013 1:33 PM
    Moderator