我正在尝试从 Sharepoint 文档库中的文件获取 Workbook 对象。
根据微软 https://learn.microsoft.com/en-us/graph/api/resources/excel?view=graph-rest-1.0,Excel需要Files.Read
or Files.ReadWrite
(或者,对于 Sharepoint 存储的文件Sites.Read
or Sites.ReadWrite
)。 Bearer 令牌具有以下范围:
"scope": "profile openid email https://graph.microsoft.com/Files.ReadWrite https://graph.microsoft.com/Sites.ReadWrite.All https://graph.microsoft.com/User.Read https://graph.microsoft.com/.default"
当我通过以下方式访问文件时:https://graph.microsoft.com/v1.0/sites/ https://graph.microsoft.com/v1.0/sites/{{SiteId}}/drives/{{DriveId}}/root:/{{FilePath}}
我按预期得到了一个文件对象。
当我尝试时:
https://graph.microsoft.com/v1.0/sites/{{SiteId}}/drives/{{DriveId}}/root:/{{FilePath}}:/workbook
I get:
{
"error": {
"code": "AccessDenied",
"message": "Could not obtain a WAC access token.",
"innerError": {
"request-id": "52535b63-b77a-4140-b6b3-9291016c26a5",
"date": "2019-10-08T23:35:28"
}
}
}
Looking 这似乎是一个已修复的暂时性错误(尽管我已经遇到该错误超过 12 小时)或一个权限错误。
我可以确认这可以访问存储在我的 OneDrive 上的文件的工作簿,但为什么它不适用于 Sharepoint?
我缺少什么权限?或者这是别的什么?