使用 sharepoint api 获取子文件夹中的文件

Posted

技术标签:

【中文标题】使用 sharepoint api 获取子文件夹中的文件【英文标题】:Get file in a subfolder with sharepoint api 【发布时间】:2021-10-31 01:35:00 【问题描述】:

我有一个如下所示的共享点文件结构:

MainFolder -> SubFolder -> FileFolder -> myfile.txt

我能够使用 api 端点检索 MainFolder 元数据:

https://siteRoot/site/_api/web/lists/getByTitle('MainFolder')/rootfolder

但我终其一生都无法确定使用哪个端点来检索 myfile.txt。任何帮助将不胜感激。

【问题讨论】:

【参考方案1】:

您可以使用以下端点来检索文件:

https://tenant.sharepoint.com/sites/yoursite/_api/web/GetFileByServerRelativeUrl('/sites/yoursite/MainFolder/SubFolder/FileFolder/myfile.txt')

【讨论】:

以上是关于使用 sharepoint api 获取子文件夹中的文件的主要内容,如果未能解决你的问题,请参考以下文章

SharePoint 2013 - REST API about Content

powershell 这将使用power shell获取特定SharePoint网站集下的所有子网站的列表。第二个文件获取我们的子站点

如何在 SharePoint 框架 Web 部件中调用 SharePoint 搜索 API 以获取最近的新闻?

使用Graph API获取SharePoint组名称

当文件名中有#符号时,Sharepoint REST API GetFileByServerRelativeUrl

如何从sharepoint中的文件夹中获取所有文件?