locked
Creating OneNote 2010 COM Add Ins RRS feed

  • Question

  • Hi,


    Sorry if this is the wrong place, I can't see where to post this.

    I am trying to create an add in for OneNote 2010 to provide buttons on the ribbon, using C# in VS2010. I attempted to follow the instructions at http://support.microsoft.com/kb/302901/en-us however, despite successfully creating an add in (in that it can load) for Word, I could not adapt the installer to install for OneNote (I added an extra registry key and reran the installer, it appears as a COM addin, but gives:

    Load Behavior: Not loaded. A runtime error occurred during the loading of the COM Add-in.

    In Word the add-in operates as expected.

    I also tried to create an add-in from scratch without the wizard but I cannot make OneNote load it.

    Does anybody know how to create an add-in for OneNote 2010 or where I am going wrong? I know it is possible to do (the Microsoft Mathematics Add-in does it) but I can't see how.

    Thanks in advance,

    Sam Nicholson
    Friday, September 24, 2010 12:02 AM

Answers

  • Hello Sam,

    Sorry for mistaking this scenario. I thought there was an Application Host (OneNote) in step 2. However, there is no such a host. So we could not create a Shared Add-in for OneNote directly. And the shared add-in for Word could not be used for OneNote by add registry key in the above registry hive. It is because that the registry of a Shared add-in is not just in HKLM\Software\Microsoft\Office\Word\Addins, there also some registries in other hives. You could find the whole registry and will find it also has a CLSID value in HKEY_CLASSES_ROOT.

    For more information, I recommend you ask in Answer site, and you're more likely to find people knowledgeable in this area. The link is here:

    OneNote: Sharing, Creating and Managing Notebooks:
    http://social.answers.microsoft.com/Forums/en-IN/addonenote/threads.

    Thanks for your understanding, and have a nice day.

    Best regards,
    Bessie Zhao - MSFT
    MSDN Subscriber Support in Forum
    If you have any feedback of our support, please contact msdnmg@microsoft.com.
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    • Marked as answer by Bessie Zhao Tuesday, October 5, 2010 2:59 AM
    Wednesday, September 29, 2010 8:00 AM
  • Hi Sam,

    One important point to be noted about OneNote add-ins (be it an IDTExtensibility2 based add-in or IOneNoteAddIn based add-in) is that, it needs to be out-of-process component. A dll is an in-process component. So, we would need to use Dll Surrogate to host the add-in. The same steps mentioned in case of old IOneNoteAddIn based add-ins would work:

    http://elhombre.members.winisp.net/api/How%20to%20Create%20a%20OneNote%20Toolbar%20Addin.pdf
    (Look at : GETTING THE .NET FRAMEWORK TO CALL OUR C# COM CODE VIA A DLL SURROGATE)  

    Additionally, note that since the add-in loads in a seperate process (dllhost), debugging it is a little tricky. Please refer:
    http://blogs.msdn.com/b/descapa/archive/2007/05/01/debugging-a-onenote-toolbar-addin-c.aspx

    Thanks,
    Ankush


    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread. Regards, Ankush Microsoft Online Community Support
    • Marked as answer by Bessie Zhao Tuesday, October 26, 2010 3:06 AM
    Monday, October 25, 2010 8:46 PM

All replies

  • Hello Sam,

    I'd like to suggest you could troubleshoot this issue by following the steps in this MSDN page: http://blogs.msdn.com/b/vsod/archive/2008/04/22/troubleshooting-com-add-in-load-failures.aspx. Also you will probably get more useful information. Also you could try to create a very simple shared add-in just with a message box, and see if this add-in could be loaded successfully.

    Here is a thread about shared add-in which might interest you: http://social.msdn.microsoft.com/Forums/en-US/innovateonoffice/thread/4c86ff27-f235-46a9-8ebd-d816c441b4f2.

    If you have any concern for this post, just feel free to come back.

    Best regards,
    Bessie


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Monday, September 27, 2010 9:51 AM
  • Hi Bessie,

     

    Thanks for getting back to me. I generated a new, blank Word add-in using the Shared Addin Wizard, configured the OnConnection and OnStartupComplete event handlers to create a messagebox when they run and, on starting Word, I see my two messageboxes.

    Then I added a registry key in HKCU\Software\Microsoft\Office\OneNote\Addins to replicate the entries (FriendlyName, Description, LoadBehavior) for my Word addin. The message boxes are not displayed when I start OneNote, and it is still shown as not loaded due to a run-time error. I used the debugging steps in the article you pointed me to, and have used all those that apply (I am developing this as a .NET 4.0 project on Office 2010 Professional, so some of them don't) and still can't load the addin.

    If you (or anyone else) have a few minutes, could you create a blank Shared Addin in Visual Studio, adapt it for OneNote by adding the registry entries above and test it, I have tried it on another machine and the same problem occurs, I cannot see any way to solve this.

     

    Thanks in advance,

     

    Sam

    Monday, September 27, 2010 3:08 PM
  • Hello Sam,

    Sorry for mistaking this scenario. I thought there was an Application Host (OneNote) in step 2. However, there is no such a host. So we could not create a Shared Add-in for OneNote directly. And the shared add-in for Word could not be used for OneNote by add registry key in the above registry hive. It is because that the registry of a Shared add-in is not just in HKLM\Software\Microsoft\Office\Word\Addins, there also some registries in other hives. You could find the whole registry and will find it also has a CLSID value in HKEY_CLASSES_ROOT.

    For more information, I recommend you ask in Answer site, and you're more likely to find people knowledgeable in this area. The link is here:

    OneNote: Sharing, Creating and Managing Notebooks:
    http://social.answers.microsoft.com/Forums/en-IN/addonenote/threads.

    Thanks for your understanding, and have a nice day.

    Best regards,
    Bessie Zhao - MSFT
    MSDN Subscriber Support in Forum
    If you have any feedback of our support, please contact msdnmg@microsoft.com.
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    • Marked as answer by Bessie Zhao Tuesday, October 5, 2010 2:59 AM
    Wednesday, September 29, 2010 8:00 AM
  • Hello again Sam,

    I am writing to check the status of the issue on your side. If you have any questions or concerns, please feel free to let me know, or unmark the post back. We will be more than happy to be of assistance.

    Best regards,
    Bessie Zhao - MSFT
    MSDN Subscriber Support in Forum
    If you have any feedback of our support, please contact msdnmg@microsoft.com


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Tuesday, October 5, 2010 2:59 AM
  • Hi Sam,

    One important point to be noted about OneNote add-ins (be it an IDTExtensibility2 based add-in or IOneNoteAddIn based add-in) is that, it needs to be out-of-process component. A dll is an in-process component. So, we would need to use Dll Surrogate to host the add-in. The same steps mentioned in case of old IOneNoteAddIn based add-ins would work:

    http://elhombre.members.winisp.net/api/How%20to%20Create%20a%20OneNote%20Toolbar%20Addin.pdf
    (Look at : GETTING THE .NET FRAMEWORK TO CALL OUR C# COM CODE VIA A DLL SURROGATE)  

    Additionally, note that since the add-in loads in a seperate process (dllhost), debugging it is a little tricky. Please refer:
    http://blogs.msdn.com/b/descapa/archive/2007/05/01/debugging-a-onenote-toolbar-addin-c.aspx

    Thanks,
    Ankush


    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread. Regards, Ankush Microsoft Online Community Support
    • Marked as answer by Bessie Zhao Tuesday, October 26, 2010 3:06 AM
    Monday, October 25, 2010 8:46 PM
  • Hello Ankush,

    Thanks very much for sharing these good resources with us. At the same time I am sorry for missing these articles. Have a nice day.

    Best regards,
    Bessie Zhao - MSFT
    MSDN Subscriber Support in Forum
    If you have any feedback of our support, please contact msdnmg@microsoft.com


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Tuesday, October 26, 2010 3:06 AM