我正在尝试从Sharepoint文档库中的文件中获取Workbook对象。
根据Microsoft,Excel需要Files.Read
或Files.ReadWrite
(或者,对于Sharepoint存储的文件Sites.Read
或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/ {{SiteId}} /驱动器/ {{DriveId}} / root:/ {{FilePath}}
我得到了预期的文件对象。
当我尝试:
https://graph.microsoft.com/v1.0/sites/{{SiteId}}/drives/{{DriveId}}/root:/{{FilePath}}:/workbook
我得到:
{
"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"
}
}
}
看around,这似乎是已修复的暂时性错误(尽管我已经解决了12个多小时)或权限错误。
我可以确认它可以访问工作簿中存储在我的OneDrive上的文件,但是它不适用于Sharepoint吗?
我缺少什么权限?还是其他?
答案 0 :(得分:2)
对于私有One Drive和SharePoint文档库,我都遇到了相同的错误。我试图打开一个宏启用模板文件.xltm。当我将文件重命名为.xlsm时,错误停止了。我是使用Microsoft Graph和Office 365的新手。好像不支持模板文件?就我而言,与文件名本身无关。