无法使用microsoft graph api

时间:2016-04-27 17:03:02

标签: office365 onenote microsoft-graph

我正在尝试访问图形api来阅读笔记页面,我收到了这个错误。

{
  "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: Notes.ReadWrite.All,Notes.Read.All",
    "innerError": {
      "request-id": "d333a0ee-fe7c-4743-8498-350dc340dd8e",
      "date": "2016-04-27T16:52:22"
    }
  }
}

我已将新应用添加到工作帐户,并为我的应用添加了所需的委派权限。许可详情如下。

资源:Microsoft Graph 权限范围:读取用户笔记本

资源:OneNote 权限范围:查看一个笔记本笔记本,查看组织中的一个笔记本笔记本。

我正在使用的端点: https://graph.microsoft.com/beta/me/notes/pages

我没有在之前提出的同一个问题中找到答案 OneNote API - no HTTP Resource found?

2 个答案:

答案 0 :(得分:1)

你可以给"读取用户可以访问的所有笔记本(预览)"或" 读写用户可以访问的笔记本(预览)" Microsoft Graph的权限: enter image description here

在我的测试中,如果没有这些权限,我将获得与您相同的错误,具有以下任何权限," https://graph.microsoft.com/beta/me/notes/pages"端点工作正常,此端点需要Notes.ReadWrite.All或Notes.Read.All范围。

答案 1 :(得分:0)

发现您的此请求定位为GET https://graph.microsoft.com/beta/me/notes/notebooks

我们在令牌中发现了以下范围 - Notes.Create,Notes.Read,Notes.ReadWrite,Notes.ReadWrite.CreatedByApp

但没有Notes.ReadWrite.All,Notes.Read.All范围。

你能仔细检查你指定的范围吗?