none
Outlook 2016 addin not working RRS feed

  • Question

  • Hi

    I create a new addin for outlook 2016 with IDTExtensibility2. Only give a message box on "OnConnection" method in connect.cs file. I installed the project. When I open the Outlook messagebox is not displaying. I checked the loadbehavior in registry. First it value is "2". So I manually changed the loadbehavior to "1". And I also checked Files->Options->Addins. My Addin is under Active Application Addins. Then Why it not displaying the message box ?

    The developing and testing machine is same. I installed office 2016 trial version. In project I added reference of  Microsoft.Office.Interop.Outlook and Microsoft.Office.Interop.Office. Both version is 14.0.0.0. I need to install PIA for outlook 2016?

    Thanks

    Bobbin Paulose

    Saturday, April 2, 2016 12:20 PM

All replies

  • Change LoadBehavior to 3
    Saturday, April 2, 2016 12:53 PM
  • Hello Bobbin,

    Please refer to the following table when you choose a value for the LoadBehavior key:

    Value (in decimal)

    Add-in status

    Add-in load behavior

    Description

    0

    Unloaded

    Do not load automatically

    The application never tries to load the add-in automatically. The user can try to manually load the add-in, or the add-in can be loaded programmatically.

    If the add-in is successfully loaded, theLoadBehavior value remains 0, but the status of the add-in in the COM Add-ins dialog box is updated to indicate that the add-in is loaded.

    1

    Loaded

    Do not load automatically

    The application never tries to load the add-in automatically. The user can try to manually load the add-in, or the add-in can be loaded programmatically.

    Although the COM Add-ins dialog box indicates that the add-in is loaded after the application starts, the add-in isn't actually loaded until it is loaded manually or programmatically.

    If the application successfully loads the add-in, the LoadBehavior value changes to 0, and remains at 0 after the application closes.

    2

    Unloaded

    Load at startup

    The application does not try to load the add-in automatically. The user can try to manually load the add-in, or the add-in can be loaded programmatically.

    If the application successfully loads the add-in, the LoadBehavior value changes to 3, and remains at 3 after the application closes.

    3

    Loaded

    Load at startup

    The application tries to load the add-in when the application starts. This is the default value when you build or publish an add-in in Visual Studio.

    If the application successfully loads the add-in, the LoadBehavior value remains 3. If an error occurs when loading the add-in, theLoadBehavior value changes to 2, and remains at 2 after the application closes.

    8

    Unloaded

    Load on demand

    The application does not try to load the add-in automatically. The user can try to manually load the add-in, or the add-in can be loaded programmatically.

    If the application successfully loads the add-in, the LoadBehavior value changes to 9.

    9

    Loaded

    Load on demand

    The add-in will be loaded only when the application requires it, such as when a user clicks a UI element that uses functionality in the add-in (for example, a custom button in the Ribbon).

    If the application successfully loads the add-in, the LoadBehavior value remains 9, but the status of the add-in in the COM Add-ins dialog box is updated to indicate that the add-in is currently loaded. If an error occurs when loading the add-in, the LoadBehavior value changes to 8.

    16

    Loaded

    Load first time, then load on demand

    Set this value if you want your add-in to be loaded on demand. The application loads the add-in when the user runs the application for the first time. The next time the user runs the application, the application loads any UI elements that are defined by the add-in, but the add-in is not loaded until the user clicks a UI element that is associated with the add-in.

    When the application successfully loads the add-in for the first time, the LoadBehaviorvalue remains 16 while the add-in is loaded. After the application closes, the LoadBehaviorvalue changes to 9.

    If you need to get application loading add-ins you need to set the LoadBehavior to 3.

    Note, Microsoft Office applications can disable COM Add-ins that behave unexpectedly. If an application does not load your Add-in, the application might have hard disabled or soft disabled your add-in.

    Hard disabling can occur when an Add-in causes the application to close unexpectedly. It might also occur on your development computer if you stop the debugger while the OnConnection event handler in your Add-in is executing.

    Soft disabling can occur when a Add-in produces an error that does not cause the application to unexpectedly close. For example, an application might soft disable an Add-in if it throws an unhandled exception while the OnConnection event handler is executing.

    When you re-enable a soft-disabled Add-in, the application immediately attempts to load the Add-in. If the problem that initially caused the application to soft disable the Add-in has not been fixed, the application will soft disable the Add-in again.  Read more about that in the How to: Re-enable a VSTO Add-in That Has Been Disabled article.

    Saturday, April 2, 2016 3:32 PM
  • Hi 

    Thanks for your reply...

    First up all I'm not using VSTO. I'm using Shared add in project with IDTExtensibility2 dll. I manually changed the LoadBehavior to 3 in registry.  But after i change the  loadbehavior to 3 and open the outlook it automatically change loadbehavior  to 2 :(

    Thanks

    Bobbin Paulose

    Sunday, April 3, 2016 3:35 AM
  • There is  a problem with the add-in that is causing that behavior by Outlook.  Try debugging the add-in by setting a breakpoint in the OnConnection method code.  Assuming you are using Visual Studio, in the add-in project's debugging options specify Outlook as the program to be debugged in the "Command' setting.  After Outlook is started under the debugger the breakpoint set in OnConnection will be hit after Outlook loads the add-in.  You can then step through the code to determine where the problem is.  You must reset LoadBehavior back to 3 beforehand so that Outlook loads the add-in during the debugging process.



    • Edited by RLWA32 Sunday, April 3, 2016 10:34 AM
    Sunday, April 3, 2016 10:33 AM
  • Hello Bobbin,

    It doesn't matter whether VSTO is used or not. The same rules can be applied to all Office COM add-ins. If your add-in fires an exception at startup Office applications can disable it automatically and set the LoadBehavior key correspondingly.

    Make sure the OnConnection is finished successfully and all the required components were installed prior loading the add-in.
    Sunday, April 3, 2016 11:10 AM
  • Hi

    I set a breakpoint on Onconnection Method and also set the outlook exe on start external program under debug tab. Now when I run the addin in debug mode, it will open the outlook. But the control is not coming to the Onconnection method.

    As I said before I'm installed the trial version of office 2016. Is these the problem of that?

    Thanks

    Bobbin Paulose

    Monday, April 4, 2016 3:22 PM
  • Hi Eugene

    I checked in debug mode. Control is not coming to Onconnection method.

    As I said before I'm installed the trial version of office 2016. Is these the problem of that?

    Thanks

    Bobbin Paulose

    Monday, April 4, 2016 3:24 PM
  • Hi

    I set a breakpoint on Onconnection Method and also set the outlook exe on start external program under debug tab. Now when I run the addin in debug mode, it will open the outlook. But the control is not coming to the Onconnection method.

    As I said before I'm installed the trial version of office 2016. Is these the problem of that?

    Thanks

    Bobbin Paulose

    Did you remember to reset LoadBehavior to 3?

    When Outlook is running under the debugger does Visual Studio indicate that the breakpoint is enabled?  The DLL that Outlook loads must be the same debug version of the DLL that was most recently built.  Did you copy the most recent debug build of the DLL to the location where Outlook will find it?


    • Edited by RLWA32 Monday, April 4, 2016 3:29 PM
    Monday, April 4, 2016 3:27 PM
  • Hi RLWA

    I cross checked the loadbehavior value. Its 3 before start the outlook. If outlook started it changed to 2.

    I'm using the framework 4.5. And the trial version of office 2016. Is there any problem for this?

    Can i get the log or anything?

    Monday, April 4, 2016 4:37 PM
  • When Outlook is running under the debugger does Visual Studio indicate that the breakpoint is enabled?  The DLL that Outlook loads must be the same debug version of the DLL that was most recently built.  Did you copy the most recent debug build of the DLL to the location where Outlook will find it?

    Did you do the above also?
    Monday, April 4, 2016 4:45 PM
  • Hello Bobbin,

    The Starter edition of MS Office doesn't support COM add-ins.

    Go to the COM add-ins list and check your add-in name there. Is it listed as active or not?

    If you don't see the add-in name  in the list, see Registry Entries for Application-Level Add-Ins. Make sure all the required windows registry entries were added.

    Monday, April 4, 2016 5:38 PM
  • Hai Eugene

    I checked in add in list. Its there. But Its under disabled list.

    Thanks 

    Bobbin

    Tuesday, April 5, 2016 6:08 AM
  • Hi Bobbin,

    The add-in was disabled due to the following reasons:

    1. Any of the required dependencies is absent on the machine.

    2. An exception was fired in the OnConnection and OnStartupComplete callbacks.

    3. The Antivirus on the system may be blocking the Add-in.

    4. Any conflict with other add-ins that are being loaded in the Office application. 

    Take a look at the Troubleshooting COM Add-In load failures article for more information.


    [custom.development]


    Tuesday, April 5, 2016 8:16 AM
  • Hi

    Is there any provision to see the error details of addin or any log is writing by windows?

    Its now coming to onconnection method

    Thanks

    Bobbin

    Thursday, April 7, 2016 5:08 PM
  • Look in the Application Event log in the Event Viewer for entries from Outlook.

    What changed that your OnConnection method is now being called?

    If your OnConnecton method is being called then you should be able to step through the code in the debugger.  Doing that should enable you to find the origin of the error which causes Outlook to unload the add-in and reset LoadBehavior.
    • Edited by RLWA32 Thursday, April 7, 2016 5:32 PM
    Thursday, April 7, 2016 5:11 PM
  • Hi RLWA32

    Onconnection Method is not working. I put break point on the first line of onconnection method and run the project in debug mode. But it not comming to that point. 

    I think the problen is "Any of the required dependencies is absent on the machine.".

    Can anyone explane what all dependencies i need to install in my developing machine. I'm using 2010vs and outlook2016. Actualy its a old project so its using 2.5 framework as traget framework in settings.


    Monday, April 11, 2016 7:08 AM
  • Hi

    I've  a small addin. Only thing is just show a message in onconnection method. Its worked in outlook 2013. But its not worked in outlook 2016

    Thanks

    Bobbin

    Tuesday, April 12, 2016 1:53 PM
  • Hi

    Is there any provision to see the error details of addin or any log is writing by windows?

    Its now coming to onconnection method

    Thanks

    Bobbin

    And later you said that "OnConnection Method is not working".

    Which is it?

    Tuesday, April 12, 2016 1:58 PM
  • When i checked in 2013 its working but in 2016 its not even working the onconnection method :(
    Tuesday, April 12, 2016 2:04 PM
  • Have you done the things that have been recommended such as checking the Application event log for Outlook entries and reading Troubleshooting com add-in load failures?

    Tuesday, April 12, 2016 2:08 PM