Creating Toolbar Buttons in OneNote 2007

Creating Toolbar Buttons in OneNote 2007

  • Comments 25

As I mentioned on Monday you can create toolbar buttons in OneNote 2007. This enables some great scenarios such as:

  • Checking in files or having them publish to another program
  • Run your code instead to do something with the current page
  • And more obviously

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:

Additionally you can have OneNote run your code whenever you run OneNote and we will send you events that you might be interested in. OneNote will send events for whenever the user changes some content on a page or whenever they navigate to another section/page, etc.

We really envision many cool toolbar buttons and addins; here are some things which are in the pipeline:

  • Word Count – One of the testers on the team wrote an application which will give you the current word count of the page you are viewing.
  • Sort Pages – I am writing an app which will sort all of your page tabs in alphabetical order (still one nasty bug with subpages that I need to fix).
  • Web Export to SharePoint – Another PM on the team has written this great app which will export the current notebook as a webpage and you can easily publish it to a SharePoint site!

So here are just 3 of the toolbar buttons that we have written and there are more in the pipeline but there are *plenty* of opportunities for you to write your own powertoys and applications. Such as:

That being said I would like to give you all documentation on how to create your own toolbar addin. Note that this will not work unless you have B2TR and my directions are for use in C#. I will have to create another for C++ in the future (though I will have to dust off my C++ skills since I only use C# now). That being said this should help you get started right away with writing powertoys and applications

Creating a Toolbar Addin for OneNote 2007 (DRAFT) (PDF)

Creating a Toolbar Addin for OneNote 2007 (DRAFT) (XPS)

In the future I plan on releasing a sample project that you can download and I will also dissect a toolbar addin that I wrote to test one of the new API calls. Please give me feedback on this and let me know what you think, I believe this will be a good starting point for most people. Once B2TR comes out then you can try your code out!

Leave a Comment
  • Please add 1 and 2 and type the answer here:
  • Post
  • Can't wait to get a copy of TR so I can give this a try!
  • I just created a test project based on your toolbar creation PDF using the RTM version of Office 2007.   It builds fine as long as I don't click on the 'Register for COM interop' button in the project properties.  If I click that, I get this error:

    The assembly "C:\Users\grosch.AMR\Documents\Visual Studio 2005\Projects\One Note\ShowOneNoteXMLAddin\ShowOneNoteXMLAddin\bin\Debug\ShowOneNoteXMLAddin.dll" could not be converted to a type library. Type library exporter encountered an error while processing 'ShowOneNoteXMLAddin.Class1, ShowOneNoteXMLAddin'. Error: Element not found.

    Are there any changes for the RTM version?  I'm guessing we don't need the OneNoteAddin.cs class file any longer as the IOneNoteAddIn interface is already published (though I tried both with and without it to resolve the above error)

  • Ignore that last comment.  I had specified the project's GUID on the class instead of a unique GUID, which is what caused the problem.

  • Great glad to hear!

  • Hi, OneNote 2007 is my favorite and most-used application, and will remain so. So please do bear with me during this litany of complaints and feature requests, made in hopes that MS won't neglect ON2007 as it did ON2003.

    his has the I am sure unintentional result of making Firefox far more

    Why are so many really basic features still missing from ON2007 integration?

    Yes, you're working on a Wordcount add-in -- probably have have one that works just fine for some time, yet it still hasn't been released, and anyhow, it should have been built-in to the application.

    Here it is, the latest version of a product marketed to both students and journalists (I'm in the latter category), yet to get a length after each and every revision I have to do a cut and paste to and from Microsoft Word.  Crikey!

    And no built-in context menu integration for OneNote 2007 at all? How can this be?

    It can't be that Microsoft actually intends for the Mozilla Firefox Browser to be far more useful to true OneNote devotees like myself, yet it is! With the FF "clipnote" extension, I can send webclippings in their original, editable form, right from the context menu, and this extension works equally well with ON2003 and ON2007.

    (note: for Firefox 2 and beyond, you do have to change the version numbers in the extension's rdf files for it to install properly but this is a 10-second tweak).

    And to add insult to injury, there isn't even a keyboard shortcut to export editable clippings from IE7 to ON2007 -- one must maneuver away from one's selection up to a menu, then a submenu!

    Yet I'm sure that like the WordCount utility, there's already a keyboard shortcut implementation that simply hasn't been released, along with a slew of other sweet powertoys you clever OneNote guys have stashed, tho if and when we see them, I won't hold my breath.

    MS seems stuck in the same rut as it was with ON2003, soliciting add-ons from a multitude of talented creative people, than doing little or nothing with them.

    What and who was the OneNote 2003 PowerToy contest for? Most of the winning utilities were never released, released only momentarily, released in crippled versions, or packaged within large MS software apps or service packs in such a way that the average ON user wasn't aware they existed.

    As for the free Education Pack, very nice indeed. It would have been nicer to  pick and choose which utilities to install rather than all or nothing, but that's as per usual with Microsoft.

    Unfortunately, what Microsoft gaveth with the Education Pack, it took away with XPSP2, after the application of which the Education Pack utilities ceased to function.

    From then on in, I got an error message stating that the Education Pack required SP1 or Higher, but Higher? Not! I tried uninstalling, and reinstalling ON and EP. No Go.

    I even tried reformatting and reinstalling XP and SP2 along with ON and EP, figuring perhaps my XP install was corrupted. Forget about it. And of course, Microsoft does not permit users to rollback from SP2 to SP1 (really, what's up with MS's insistence upon protecting us from ourselves with no possibility for even the more technical among us to override such protection? Some kind of infantalizing fetish?)

    But I digress from my digression, as it is OneNote 2007 that now concerns me. Even with the aforesaid flaws, it is a delight, by far the most useful and appealing product in the entire Office Suite, despite being cast by MS in its role as Office 2007's poor, orphan relation.

    Where's the promotion of OneNote? Where's the marketing, apart from misleadingly portaying it as a Tablet PC niche product when it's an all in one web-clipper, research tool, database-creator and on the fly word processor, and that's only for starters?

    Very foolish, from a revenues standpoint, however, that is Microsoft's problem. Mine is usability, and ON 2007 is still lacking in crazily basic ways.

    Come on -- you present us with built in OCR reading and searching capabilities , completely integrated audio recording and audio seach, but if we want to word-length or text export we should go scratch ourselves?

    I mean, the sendto printer driver's okay, but being able to export from your word processing app as a graphic is in no way a substitute for being able to export as editable text, the latter being far more important to most users.

    And please don't tell me doc/txt export is on its way for Word 2007 because that's too little in addition to  being late.

    I won't be using Word 2007. For me the extra features since 2003 don't justifying the added bulk, loading time or resource usage.

    And anyhow, as OneNote is being marketed and sold as a standalone product, I expect it to function that way -- not as a cripple-ware addition that's really a come-on for the rest of Office 2007.

    Anyhow, thanks for letting me vent and well ... do you think maybe after all that you'd consider supplying me with the wordcount add-on now as a alpha or beta, ready for primetime or not?

    As you can see from my comment-length, I really do need it!

    Best,

    Amy

  • I just got an email last week from Michael at Mindjet where he wrote me about a new app he wrote that

  • I couldn't get the example posted in the write up to work.  I needed a working example, that provided me with something to look at.  The problem was I was missing the {} in my installer.

    http://feeds.feedburner.com/joshuaflanagan (RSS feed) provide a great one with is quite handy to boot.

  • Did you ever locate someone who could translate the C# into vb.net?

    I've worked through this and have everything working up to the click event which I am sure I got wrong somewhere in my hack attempt at understanding C#. I just can't get my app to start when the toolbar button is clicked. Any chance of seeing the add-in code that is used for the Search & Replace powertoy? As a sample for us infinitly inferior vb users.

  • The sample code and setup instructions helped me add a button on the toolbar. I'll like to associate an icon with the button. How can I achieve this? What should be the registry settings to get this working?

  • There is a IconPath value in the registry that points this out.  It is all in the documentation.

  • I have added add-in in toolbar by following same instruction as mentioned in the document. I'll like to  add another button on the toolbar, i followed the same instructions for registry for adding second button into toolbar but after running setup i couldn't find second button, i can see only one button in my toolbar. What should I do to get this working?

  • Ravi - Make sure that you register the second button in the registry.  For each button there will be a new path until the Addin key in the registry.  Make sense?  Install a few of the powertoys from my blog and John's blog and then look in the registry to get an idea of how this works.

  • http://msdn2.microsoft.com/en-us/library/aa286798.aspx - Section OneNote Add-ins and Toolbar Buttons talks about facilitating the developer with an option to specify whether OneNote launches custom code when it starts or when a user clicks a button in the UI.

    I'll like to know how we can launch the custom code when OneNote is launched? In the business scenario that I have, I need to monitor a set of OneNote files stored in a specific folder on the file - system  to track the attachments added to the files. I plan to do this using the FileSystemWatcher and OneNote API. I do not want to write a windows service for the same since the scope of the FileSystemWatcher is restricted to the OneNote application domain.

    Any suggestions on how I can achieve the same?

  • I had followed all the steaps whtever mention the above document, but still the custom button is not displayed on the onenote toolbar

  • I had followed all the steaps whtever mention the above document, but still the custom button is not displayed on the onenote toolbar.what may be the problem

Page 1 of 2 (25 items) 12