<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://www.clyxstudios.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>clyx development blog : API</title><link>http://www.clyxstudios.com/blogs/development/archive/tags/API/default.aspx</link><description>Tags: API</description><dc:language>en</dc:language><generator>CommunityServer 2.1 SP2 (Build: 61129.1)</generator><item><title>Managed DataImport Class Library for OneNote</title><link>http://www.clyxstudios.com/blogs/development/archive/2006/08/21/Managed-DataImport-Class-Library-for-OneNote.aspx</link><pubDate>Mon, 21 Aug 2006 22:43:00 GMT</pubDate><guid isPermaLink="false">ce91e018-d46e-43ff-806c-101a08402f3c:63</guid><dc:creator>Rohan</dc:creator><slash:comments>1</slash:comments><comments>http://www.clyxstudios.com/blogs/development/comments/63.aspx</comments><wfw:commentRss>http://www.clyxstudios.com/blogs/development/commentrss.aspx?PostID=63</wfw:commentRss><wfw:comment>http://www.clyxstudios.com/blogs/development/rsscomments.aspx?PostID=63</wfw:comment><description>&lt;p&gt;&lt;a href="http://lange.officeisp.net/DataImport/" target="_blank"&gt;This library&lt;/a&gt; is an easy and fun way to integrate OneNote with .NET apps.&amp;nbsp; We&amp;#39;ve used it for our freeware &lt;a href="http://www.clyxstudios.com/blogs/software/archive/2006/03/21/OmeaPlugins.aspx" target="_blank"&gt;Send to OneNote Omea plugin&lt;/a&gt; and&amp;nbsp;will be using it with a&amp;nbsp;future product.&lt;/p&gt;&lt;p&gt;The library works well and nicely abstracts the complexity of the OneNote API and XML schema.&amp;nbsp; For instance, here&amp;#39;s how you create a OneNote page with the library:&lt;/p&gt;&lt;div class="wlWriterSmartContent" id="F2210F5F-69EB-4d4c-AFF7-B8A050E9CC72:87dc6abb-f362-44c5-a4de-df949c5044a1" style="display:inline;float:none;margin:0px;width:653px;padding:0px;"&gt;&lt;pre&gt;&lt;div&gt;&lt;span style="color:#000000;"&gt;Page page &lt;/span&gt;&lt;span style="color:#000000;"&gt;=&lt;/span&gt;&lt;span style="color:#000000;"&gt; &lt;/span&gt;&lt;span style="color:#0000ff;"&gt;new&lt;/span&gt;&lt;span style="color:#000000;"&gt; Page(sectionPath, bodySubject);
OutlineObject outline &lt;/span&gt;&lt;span style="color:#000000;"&gt;=&lt;/span&gt;&lt;span style="color:#000000;"&gt; &lt;/span&gt;&lt;span style="color:#0000ff;"&gt;new&lt;/span&gt;&lt;span style="color:#000000;"&gt; OutlineObject();
outline.AddContent(&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;new&lt;/span&gt;&lt;span style="color:#000000;"&gt; HtmlContent(body));
            
&lt;/span&gt;&lt;span style="color:#008000;"&gt;//&lt;/span&gt;&lt;span style="color:#008000;"&gt; adjust for OneNote 2007 margins&lt;/span&gt;&lt;span style="color:#008000;"&gt;
&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;if&lt;/span&gt;&lt;span style="color:#000000;"&gt; (Application.GetVersion().FileMajorPart &lt;/span&gt;&lt;span style="color:#000000;"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color:#000000;"&gt; &lt;/span&gt;&lt;span style="color:#000000;"&gt;11&lt;/span&gt;&lt;span style="color:#000000;"&gt;)
  outline.Position &lt;/span&gt;&lt;span style="color:#000000;"&gt;=&lt;/span&gt;&lt;span style="color:#000000;"&gt; &lt;/span&gt;&lt;span style="color:#0000ff;"&gt;new&lt;/span&gt;&lt;span style="color:#000000;"&gt; Position(outline.Position.X, outline.Position.Y &lt;/span&gt;&lt;span style="color:#000000;"&gt;+&lt;/span&gt;&lt;span style="color:#000000;"&gt; &lt;/span&gt;&lt;span style="color:#000000;"&gt;36&lt;/span&gt;&lt;span style="color:#000000;"&gt;);
            
page.AddObject(outline);
page.Commit();
&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;In the above code, &lt;font color="#808080"&gt;sectionPath&lt;/font&gt; contains the full path to the OneNote .one file you wish to use, &lt;font color="#808080"&gt;bodySubject&lt;/font&gt; contains the title text for the OneNote page, and &lt;font color="#808080"&gt;body&lt;/font&gt; contains HTML-formatted text for the page body.&amp;nbsp; The margin adjustment is optional and depends on what content you&amp;#39;re sending.&lt;/p&gt;&lt;p&gt;Compare that code with the &lt;a href="http://msdn2.microsoft.com/en-us/library/ms406042.aspx" target="_blank"&gt;API examples on MSDN&lt;/a&gt;.&lt;/p&gt;&lt;p&gt;Another bonus is that the latest version of the&amp;nbsp;library now also supports&amp;nbsp;OneNote 2007, which means you really don&amp;#39;t need to think much about what version of OneNote is in use - it just works.&lt;/p&gt;&lt;p&gt;The library is endorsed by Microsoft but was previously only available on a couple of &lt;a href="http://blogs.msdn.com/dolange/archive/2004/06/17/158976.aspx" target="_blank"&gt;blog&lt;/a&gt; &lt;a href="http://blogs.msdn.com/andrew_may/archive/2004/07/27/198813.aspx" target="_blank"&gt;posts&lt;/a&gt;.&amp;nbsp; But now it has a &lt;a href="http://lange.officeisp.net/DataImport/" target="_blank"&gt;permanent home&lt;/a&gt; courtesy of Donovan Lange.&lt;/p&gt;&lt;p&gt;We&amp;#39;ll have a new release of our &lt;a href="http://www.clyxstudios.com/blogs/software/archive/2006/03/21/OmeaPlugins.aspx" target="_blank"&gt;Send to OneNote Omea plugin&lt;/a&gt;&amp;nbsp;soon&amp;nbsp;which will include the latest version of this library, which means it will also support OneNote 2007.&amp;nbsp; &lt;em&gt;&lt;font color="#808080"&gt;(If you&amp;#39;re really keen, &lt;a href="http://www.clyxstudios.com/user/CreateUser.aspx" target="_blank"&gt;join our community&lt;/a&gt; and you&amp;#39;ll get access to an early beta release in the downloads section).&lt;/font&gt;&lt;/em&gt;&lt;/p&gt;&lt;img src="http://www.clyxstudios.com/aggbug.aspx?PostID=63" width="1" height="1"&gt;</description><category domain="http://www.clyxstudios.com/blogs/development/archive/tags/C_2300_/default.aspx">C#</category><category domain="http://www.clyxstudios.com/blogs/development/archive/tags/OneNote/default.aspx">OneNote</category><category domain="http://www.clyxstudios.com/blogs/development/archive/tags/Code+Library/default.aspx">Code Library</category><category domain="http://www.clyxstudios.com/blogs/development/archive/tags/API/default.aspx">API</category></item></channel></rss>