none
Programmatically make Outlook 2007 add-in go inactive? RRS feed

  • Question

  • I've noticed that if ThisAddIn_Startup throws an exception that is not caught, Outlook 2007 will crash whereas Outlook 2010 will make the addin go inactive.  Rather than crash Outlook 2007, I'd rather just make our add-in go in-active similar to what happens in Outlook 2010.  Does anyone know if there is an API call I can make to programmatically make our add-in go inactive from within a catch handler inside ThisAddIn_Startup?

    Thanks,
    Greg




    • Edited by gkriggs Monday, April 18, 2011 1:46 PM
    Monday, April 18, 2011 12:59 PM

Answers

  • You can't really disconnect your own addin in the addin code by using the Connect boolean property, that would only work the next time Outlook was started. The best thing to do probably would be to call a teardown method that releases all of your Outlook objects.
     
    When I do that I maintain a boolean _torndown. Then I check that in ribbon callbacks such as getVisible() and getEnabled() and I return false if _torndown is true. The ribbon callbacks will continue to fire even after you release all your objects, so you need to make provision for that.

    --
    Ken Slovak
    MVP - Outlook
    http://www.slovaktech.com
    Author: Professional Programming Outlook 2007
     
     
    "gkriggs" <=?utf-8?B?Z2tyaWdncw==?=> wrote in message news:a54ce2f3-eaeb-420a-ba36-c0c65edf14b6...

    I've noticed that if ThisAddIn_Startup throws an exception that is not caught, Outlook 2007 will crash whereas Outlook 2010 will make the addin go inactive.  Rather than crash Outlook 2007, I'd rather just make our add-in go active similar to what happens in Outlook 2010.  Does anyone know if there is an API call I can make to programmatically make our add-in go inactive from within a catch handler inside ThisAddIn_Startup?

    Thanks,
    Greg




    Ken Slovak MVP - Outlook
    • Marked as answer by gkriggs Monday, April 18, 2011 1:49 PM
    Monday, April 18, 2011 1:43 PM