Get OneNote pages through its web API

2019-08-03 16:04发布

I'm trying to develop a NodeJS that interact with the OneNote API. Currently I;m trying to retrieve the content (the HTML) of the onenote pages.

Based on the documentation (http://dev.onenote.com/docs) that is possible using he beta API, which should be www.onenote.com/api/beta/sections/{id}/pages, but I've tried many times without success. I always get an error response:

403
{
  "error":{
    "code":"40004","message":"The OAuth token provided does not have the necessary scopes to complete the request. Please make sure you are including one of the following scopes: Office.onenote_update,Office.onenote_update_by_app,Office.onenote","@api.url":"http://go.microsoft.com/fwlink/?LinkID=400836"
  }
}

I know the API works because the Web client that is present in the API Reference here works well.

If someone could shed some light on this, I would appreciated.

Thank in advance.

P.S. I can perfectly access non-beta endpoint in the same API.

1条回答
劫难
2楼-- · 2019-08-03 16:48

You're receiving this error because you haven't requested (and subsequently had the user grant) read permissions for the user's notebook, not because it is a beta API – the permissions for /v1.0 and /beta are identical.

This article on MSDN explains all of the scopes for the OneNote API.

The summary of that article is:

  • You'll want the office.onenote_update_by_app if you only need to create and recall pages for your application.
  • office.onenote_update will give you carte blanche CRUD access to all of a user's OneNote content
  • office.onenote and office.onenote_create will let you access a user's pages and create new pages, but not make edits to any of the user's notebooks, sections, or pages.
查看更多
登录 后发表回答