It was more difficult than we expected. Our fingers are exhausted, and we won't even talk about the truly frightening quantities of Mt. Dew that were consumed. The end result: a shiny pile of ones and zeros we think you'll want to meet.

Previously I hinted that Omar, David and myself have been collaborating on a nicely abstracted managed assembly that provides an object model for importing data into OneNote. But as of today, it lives!

So what does it do, you ask? Enough talk:

using Microsoft.Office.OneNote; 
namespace Example
   class TrivialImport
      public static void Main()
         // Create a new page in the section "General", with the
         // title "Import Example".

         Page p = new Page("", "Import Example");

         // Create a new Outline, and add some content to it:
         OutlineObject outline = new OutlineObject();
         outline.AddContent(new HtmlContent("Hello <i>world</i>!"));

         // Add the outline to our page:


         // Commit the changes to OneNote, and set the actively viewed page:


Try it out for yourself: the assembly, source code, documentation, and class diagrams are all available for download here.

(Note that this is a work in progress, and as a result you may encounter the occasional bug or two. So if it eats your homework, erases all of your Tivo'd episodes of Friends, or breaks up with your girlfriend -- you have been warned. Of course, if this does occur, let me know.)

Go wild; but be careful: once you start importing, it's hard to stop.

[3/22/06: Updated URLs to point to new site.]