excel - 访问 Excel 工作簿返回 "The resource could not be found."

标签 excel microsoft-graph-api

我希望连接到 Microsoft Graph API 并与我的 OneDrive 上的小型 Excel 工作簿进行交互。

我能够通过 Graph API 成功授权并连接到 OneDrive,查询我的个人 OneDrive 内容,我什至可以找到 .xlsx 工作簿并获取其 ID。对此端点的 GET 请求成功:

https://graph.microsoft.com/v1.0/me/drive/recent

对上述 GET 请求的响应包括(省略部分数据):

{createdDateTime: "2017-12-13T04:24:57Z", lastModifiedDateTime: "2017-12-13T04:26:09Z"}
id:"{id}"
name:"transactions.xlsx"

但是,在我的 Web 应用程序中,通过图形 API 调用连接到此“transactions.xlsx”工作簿似乎很困难。例如这里的 GET 请求:

https://graph.microsoft.com/v1.0/me/drive/items/{id}/workbook/worksheets('Sheet1')/usedRange

通过 Graph Explorer 成功返回工作簿数据.但是仅仅将该 API 调用复制并粘贴到我的应用程序中就会失败:

{
  "error": {
    "code": "itemNotFound",
    "message": "The resource could not be found.",
    "innerError": {
      "request-id": "7716493f-cc32-413e-b4fa-5855df7ad181",
      "date": "2017-12-13T14:54:43"
    }
  }
}

关于允许我的 OneDrive 查询通过但 Excel 查询声明未找到项目 的 Graph API 调用,我遗漏了什么?

这是企业 Microsoft Graph/O365 帐户

最佳答案

您能否尝试使用 Excel REST 的入门项目之一,看看是否可以获得预期的结果? https://github.com/microsoftgraph?utf8=%E2%9C%93&q=excelstarter

关于excel - 访问 Excel 工作簿返回 "The resource could not be found.",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47796702/

相关文章:

javascript - Microsoft Graph 客户端凭据 - 获取代表用户发送电子邮件的 oauth 错误

azure - 如何在 Microsoft Graph Mail API 上对 $filter 使用 'in' 运算符?

vba - 请参阅使用代号的表

excel - 如何将工作表中的图像嵌入 Outlook 电子邮件

graph - graph.windows.net 和 graph.microsoft.com 之间有什么区别?

sharepoint - 如何创建 Office 365 任务(Exchange、Sharepoint 和组)的合并列表

rest - 处理隐藏文件夹

excel - 如何使用 C# 获取 Excel 下拉列表中的值

vba - 使用 VBA 单击 IE 网页中的链接/按钮

excel - 如何编写使用写入单元作为引用的 UDF