Writing OneNote toolbar add-in

0.00 avg. rating (0% score) - 0 votes
Reference: Ccreating Toolbar Buttons in OneNote 2007,

We allow you to create a toolbar button which is either an icon or text that will sit on one of the OneNote command bars. They can appear on the standard toolbar at the end of the menus or on any other toolbar. When the user clicks on the button we will CoCreate your code (since you implement an interface we make available) and we send you the current page that was sent. You can see that it looks like this:

Download sample code from OneNote Web Exporter http://www.codeplex.com/ONWebber. The solution contains

  • a C# console application project called “cwebber”.
  • a C# class library project called “Webber”.
  • a setup project called “Webber Setup”.

Webber Setup will install cwebber and create its Start Menu shortcut and register Webber as a OneNote add-in. To debug Webber:

  1. Build Webber Setup and run the .msi to setup the add in
  2. At the beginning of the OnClick event of the add-in (found in Program.cs), put a MessageBox in order to suspend the process when the event has fired, given us enough time to attach the debugger.
  3. In OneNote, click on the add-in icon. The message box will be displayed.
  4. With the MessageBox displayed, go to visual studio, open the Webber solution, choose Debug->Attach to Process and select dllhost.exe (aka COM surrogate), which is the process responsible for handling the add-in’s DLL
  5. Breakpoints will now be hit.

Tip: After you’ve installed the .msi for the OneNote add-in, on some subsequent changes to the code, you don’t have to uninstall and re-install the msi. Just quit OneNote, ensure that the project properties for webber have been set to “Register for COM interop”, build it, and the changes will be reflected.

0.00 avg. rating (0% score) - 0 votes


A tough developer who likes to work on just about anything, from software development to electronics, and share his knowledge with the rest of the world.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>