通过其Web API获取OneNote页面
我正在尝试开发一个与OneNote API交互的NodeJS。 目前我试图检索onenote页面的内容(HTML)。
基于可以使用他的beta API的文档( http://dev.onenote.com/docs ),它应该是www.onenote.com/api/beta/sections/{id}/pages,但是我已经多次尝试没有成功。 我总是得到一个错误的回应:
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" } }
我知道API的工作原理,因为在这里的API参考中的Web客户端运行良好。
如果有人能够说明这一点,我将不胜感激。
预先感谢。
PS我可以完全访问同一个API中的非beta端点。
您收到此错误是因为您没有请求(并且随后有用户授予)用户笔记本的读取权限,而不是因为它是beta API,所以/v1.0
和/beta
的权限是相同的。
MSDN上的这篇文章解释了OneNote API的所有范围。
那篇文章的总结是:
- 如果您只需要为应用程序创build和调用页面,则需要
office.onenote_update_by_app
。 -
office.onenote_update
将为您提供全部用户的OneNote内容 -
office.onenote
和office.onenote_create
将允许您访问用户的页面并创build新的页面,但不能编辑任何用户的笔记本,部分或页面。