none
oOutlook = New Outlook.Application fails with CO_E_SERVER_EXEC_FAILURE RRS feed

  • Question

  • Scenario:

    VSTO outlook-addin

    Calling this in the Sub New of a customtaskpane (to load a PST),

    only fails on outlook 2013, don't seem to have this problem in 2010



    • Edited by Rbie Thursday, November 21, 2013 10:44 AM
    Thursday, November 21, 2013 9:15 AM

Answers

  • I figured that maybe outlook 2013 doesn't like it that I create another outlook application when I'm already in one.

    so I changed my code from

    oOutlook = New Outlook.Application
    
    to 
    
    oOutlook = Globals.ThisAddIn.Application

    and guess what, that worked

    Weird that I can't find anything about this difference between 2013 and previous versions on the internet :/


    • Marked as answer by Rbie Thursday, November 21, 2013 1:02 PM
    • Edited by Rbie Thursday, November 21, 2013 1:03 PM
    Thursday, November 21, 2013 12:42 PM

All replies

  • I figured that maybe outlook 2013 doesn't like it that I create another outlook application when I'm already in one.

    so I changed my code from

    oOutlook = New Outlook.Application
    
    to 
    
    oOutlook = Globals.ThisAddIn.Application

    and guess what, that worked

    Weird that I can't find anything about this difference between 2013 and previous versions on the internet :/


    • Marked as answer by Rbie Thursday, November 21, 2013 1:02 PM
    • Edited by Rbie Thursday, November 21, 2013 1:03 PM
    Thursday, November 21, 2013 12:42 PM
  • You can only ever have 1 Outlook session running at a time. Outlook 2013 purposely prevents you from trying to set a new session if it can.

    In any case no matter what version, the Application object passed to you by the addin startup is trusted and won't fire the Outlook security. If you can set a new Outlook.Application object it wouldn't be trusted, so it's not a good idea in any case.


    Ken Slovak MVP - Outlook

    Thursday, November 21, 2013 2:59 PM
    Moderator