Search code examples
onenote

Onenote API and Onenote Interop


Gday.

I am familiar with writing code to access/edit a notebook stored at a directory using the Onenote Interop classes for Desktop versions of OneNote (2007, 2010, 2013)

Now that the OnenoteAPI is out for the cloud-based OneNote (Win RT OneNote, WinPhone OneNote, and etc) I am confused as to which to use.

I'm trying to build an app that uses Onenote to store some notes. The notes will generally be accessed from few locations in a city and perhaps some mobile computers. With the Interop method, I already have a solution for (literally) copying some notebooks onto the mobile computers before they go out, and upon their return merging them back.

However, I would like to use "the cloud" as a storage option rather than storing the notebooks in one central location typically accessed through a jungle of VPNs. This is because some customers would be happy with the cloud (and not having their own server) and others will be want to at least have a copy of the data, and use the cloud as a means to be more mobile.

Now, I haven't gone around implementing nor trying things out yet. I am seeking advice from people that may have done something similar. In particular, i'd like advice/hints/clues on how to:

  1. Extract the notebook page content in a format from the OnenoteAPI that is compatible with the Interop. Similarly, push it back up to the OnenoteAPI from the Interop. Alternatively, can I somehow "export" a copy of the cloud Notebook and import it later?

  2. Would expensive SharePoint help in some way? How about the free build-into-small-office-server version suffice?

Thank you Internets.


Solution

  • N.b. given the potential for confusion I will refer to the Win32-only OneNote API as "OneNote COM API" and the modern, web-based, and OneDrive-only REST API as the "OneNote REST API"

    On #1: The HTML version of the OneNote pages we expose via the OneNote REST API does not have a 1:1 mapping to the OneNote Object Model that is exposed via the COM API; this makes interop between them difficult. Furthermore, neither of them are designed to support a full-fidelity sync experience – it's a tricky problem, and usually one where people are more than happy with the experience OneNote provides out-of-the-box.

    On #2: SharePoint could solve your problem. When your users are in the office, OneNote would sync all of its changes to SharePoint and receive the deltas it missed while it was disconnected from the intranet. If clients desire mobility, you could open up SharePoint to web access. You can then build your app using the COM API against the desktop OneNote client and rely on OneNote itself to handle syncing.

    The one caveat here is that not all SKUs of OneNote support accessing SharePoint notebooks; Win32 clients purchased as part of the Office suite can, as can any copy attached to an Office365 subscription, including Mac, iOS, and Android. To the best of my knowledge, Windows Phone does not have any such restriction.