跨子网站的 SharePoint Rest API

SharePoint Rest API across subsites

我正在尝试从顶级网站进行一次休息 api 调用,以从多个子网站上的多个图片库中获取结果。这可能吗?如果不可能,解决这个问题的最佳方法是什么。

我确实有休息 api 调用来检索所有子站点,但我需要根据单个请求从库中检索结果。

https://xxxx/_api/web/webs/?$select=title,ServerRelativeUrl

遗憾的是,无法使用单个 SharePoint REST API 调用查询多个列表,因为要从列表中获取数据,您必须指定其父网站和 title/ID。通常对于这些类型的查询,最好的选择是利用 SharePoint Search REST API (Reference) or, if you can utilize some server side code, you can use the SPSiteDataQuery class to make fetch data from across whole sites or site collections (have a look at this article about SPSiteDataQuery).

另外,看看这个 SO 问题:Fetch data from multiple list sharepoint REST API in one Ajax call