通过 Microsoft Graph 访问 Workbook 对象所需的正确权限 [英] Correct permissions required for accessing Workbook object through Microsoft Graph

查看:79
本文介绍了通过 Microsoft Graph 访问 Workbook 对象所需的正确权限的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试从 Sharepoint 文档库中的文件中获取 Workbook 对象.

I'm trying to get a Workbook object from a file in a Sharepoint document library.

根据 微软,Excel 需要 Files.ReadFiles.ReadWrite(或者,对于 Sharepoint 存储的文件 Sites.ReadSites.ReadWrite).不记名令牌具有以下范围:

According to Microsoft, Excel needs Files.Read or Files.ReadWrite (or, for Sharepoint stored files Sites.Read or Sites.ReadWrite). The Bearer token has the following scope:

"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}}/drives/{{DriveId}}/root:/{{FilePath}}

When I access the file through: https://graph.microsoft.com/v1.0/sites/{{SiteId}}/drives/{{DriveId}}/root:/{{FilePath}}

我按预期得到了一个文件对象.

I get a file object as expected.

当我尝试时:

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"
    }
  }
}

查看周围这似乎是已修复的暂时性错误(尽管我已经遇到了 12 多个小时)或权限错误.

Looking around this seems to be either a transient error that was fixed (although I've had it for more than 12 hours) or a permissions error.

我可以确认这可以访问存储在我的 OneDrive 上的文件的工作簿,但为什么它不适用于 Sharepoint?

I can confirm that this can access the workbook for a file stored on my OneDrive but whay isn't it working for Sharepoint?

我缺少什么权限?或者这是别的什么?

What permissions am I missing? Or is this something else?

推荐答案

我在使用私有 One Drive 和 SharePoint 文档库时遇到了同样的错误.我试图打开一个宏启用模板文件 .xltm.当我将文件重命名为 .xlsm 时,错误停止了.我刚开始使用 Microsoft Graph 和 Office 365.看起来可能不支持模板文件?就我而言,它与权限无关,而与文件名本身无关.

I experienced same error for both private One Drive and SharePoint document library. I was trying to open an macro enable template file .xltm. When I renamed file to .xlsm, the error stopped. I am new to using Microsoft Graph and Office 365. It looks like template files may not be supported? For my case, it had nothing to do with permission but the file name itself.

  • ExcelFile.xlsm - 有效
  • ExcelFile.xlsx - 有效
  • ExcelFile.xltm - 无法获取 WAC 访问令牌错误

这篇关于通过 Microsoft Graph 访问 Workbook 对象所需的正确权限的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆