Get OneNote pages through its web API

落花浮王杯 提交于 2020-01-15 12:30:10

问题


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:


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.


来源:https://stackoverflow.com/questions/26453800/get-onenote-pages-through-its-web-api

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!