excel - 如何在 Sharepoint 框架 (SPFx) 应用程序中使用 Excel Rest API 访问存储在 Sharepoint 在线文档库中的 Excel 数据?

标签 excel sharepoint sharepoint-online office365api spfx

我有一个使用 knockoutJS 的 Sharepoint 框架项目 (SPFx),其中应用程序将尝试使用 Excel Rest API 从存储在 Sharepoint 在线站点的 sharepoint 文档库中的 Excel 文件读取数据。

我遇到了几个文档,但它没有给我一个关于如何做到这一点的具体工作示例。

https://learn.microsoft.com/en-us/sharepoint/dev/general-development/excel-services-rest-api

https://learn.microsoft.com/en-us/sharepoint/dev/general-development/requesting-excel-workbook-data-from-sharepoint-server-using-odata

我无法获取具有此 URL 的文档列表。

http:///_vti_bin/ExcelRest.aspx/Documents/Book1.xlsx

我相信我需要创建一些身份验证方法,以便应用程序用户可以在阅读文档之前访问该文档。

我之前没有在 Sharepoint Framework (SPFx) 应用中使用过 Excel Rest API 和 Microsoft Graph。

有人可以帮我解决这个问题吗?我希望看到在 sharepoint 在线文档库中读取 excel 文件的完整工作示例。

最佳答案

对于SharePoint online,您需要使用Microsoft graph api从SharePoint online访问excel文件。

示例端点:

https://graph.microsoft.com/v1.0/sites/domain.sharepoint.com,id,id/drives/drive id/items/item id/workbook

您可以查看该线程以了解更多详细信息。

http://blog.atwork.at/post/2017/12/29/Access-files-in-OneDrive-or-SharePoint-with-Microsoft-Graph-and-the-Excel-API

Use GraphHttpClient to call Microsoft Graph

关于excel - 如何在 Sharepoint 框架 (SPFx) 应用程序中使用 Excel Rest API 访问存储在 Sharepoint 在线文档库中的 Excel 数据?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49596144/

相关文章:

excel - 根据日期对列中的值求和

excel - Excel VBA - 格式 ("7A", "00") 输出 "00"而格式 ("7B", "00") 导致所需的输出 "7A"。为什么它们不同?

javascript - 如何在 Sharepoint Online 中启用 CORS

javascript - 异步 Javascript 回调不触发 RaiseCallBackEvent 函数

javascript - 如何从术语存储 SharePoint Online 检索术语

html - 将我的网站转换为共享点网站

internet-explorer - 哪个 .dll 包含 HTMLElement 类?

Excel "true-false"到复选框

c# - 在 SharePoint Online (CSOM) 的文档库中检查和创建文件夹的最快方法?

arrays - Runscript 错误 '9' 下标超出范围