OneNote in the Microsoft Graph API (in Preview)

Good day, all! The OneNote team is excited to announce preview support for using the OneNote API through Microsoft Graph (formerly the Office 365 unified API). The Microsoft Graph API provides a single endpoint for OneNote and other Office services. You'll use this endpoint to access notes, messages, users, groups, files, and more.

https://graph.microsoft.com/

With Microsoft Graph, no more obtaining separate tokens for different services or calling a different endpoint for each API.

And that's not the only reason to celebrate! The upcoming converged app registration will let you register apps for both personal and work or school accounts. Visit the Microsoft Graph website to learn more and to try out the Graph Explorer.

For OneNote, you'll be able to access notebooks owned by the current user, OneNote content shared by other users, and Office 365 group notebooks.

 

To access user notebooks, use one of the following root URLs:

https://graph.microsoft.com/beta/me/notes/

    Accesses OneNote content that's owned by the current user. (Soon, this endpoint will allow access to notebooks shared by others with the current user.)

 

https://graph.microsoft.com/beta/users/\<userPrincipalName>/notes/

https://graph.microsoft.com/beta/users/\<id>/notes/

    Accesses OneNote content that the specified user (in the URL) has shared with the current user.

 

To access unified group notebooks, use this root URL:

https://graph.microsoft.com/beta/groups/\<id>/notes/

    Accesses OneNote content in the specified group that the current user is a member of.

 

Then, append the rest of the path to the resource. For example, this query gets the pages that AlexD shared with the current user.

https://graph.microsoft.com/beta/users/alexd\@contoso.com/notes/pages 

You can find the OneNote API reference in the Beta reference docs.

New OneNote API features

  • Support for Office 365 group notebooks. You can read more about this in our Office 365 is GA post.
  • Support OneDrive for Business shared content. Accessing group notebooks and shared content from other users requires the Notes.Read.All or Notes.ReadWrite.All permissions.
  • New parentNotebook and parentSection navigation properties for pages. The default page query returns the id, name, and self properties of the page's parent section.
  • New level and order properties for pages. These show the indentation level of the page and the order of the page within the parent section. To get them, use the pagelevel parameter in queries for pages in a section or for a specific page:

GET ../sections/{id}/pages?pagelevel=true

GET ../pages/{id}?pagelevel=true

Currently, the following scenarios are not supported:

  • Accessing consumer notebooks
  • Accessing SharePoint site-hosted notebook
  • $search pages

Let us know what you think on UserVoice, contact us on twitter @onenotedev, or ask questions tagged onenote on Stack Overflow.

 

Edit 2016-05-20: Added more detail about the root URLs. Currently, shared content is only accessible through the ../users/<id|userPrincipalName> endpoint.