Compartilhar via


C/C++ Add-Ins for OneNote 2010

Today, we're releasing the OneNote14 C++ header file which should make it easy for you to build OneNote add-ins. You can find the header file attached to the bottom of this post. Here's a quick example demonstrating how you could use the header file to get XML representation of the OneNote Hierarchy .

 

1.) Open Visual Studio and create a New C++ Win32 Console Application

 

2.) Download the header file, and copy it into your project folder with the C++ source files

3.) The following sample code, taken from the OneNote12 header post should still work, and output the XML hierarchy data of all open notebooks in your OneNote client. Just paste it into your newly created project and run it:  

 #include "stdafx.h"
#include "onenote14.h"
 
 
 
 int _tmain(int argc, _TCHAR* argv[])
 
 {
 
 CoInitialize(NULL);
 
 IApplication* piOneNote;
 
 
 
 CoCreateInstance(__uuidof(Application), NULL,
 CLSCTX_LOCAL_SERVER, __uuidof(IApplication), (void**)&piOneNote);
 
 
 
 if(piOneNote)
 {
 
 BSTR temp; 
 
 HRESULT hr = piOneNote->GetHierarchy(NULL, hsNotebooks, &temp);
 
 wprintf(L"%s", temp);
 
 }
 
 }

Here are some other resources that you might find useful: -

OneNote 2010 Developer Reference

Tutorial: Creating extensions with the OneNote OM

OneNote Object Model for C#

onenote14-x86.h

Comments

  • Anonymous
    August 25, 2011
    Fantastic, I look forward to using it! Thanks!