对于 SharePoint Online 连接器,我们使用以下步骤获取所有网站:
For SharePoint Online connector We used following steps to fetch all sites:
第 1 步:使用以下权限 xml 在 SharePoint 实例上创建加载项
Step 1: Created Add-in on SharePoint instance with following permission xml
<AppPermissionRequests> <AppPermissionRequest Scope="sharepoint/content/tenant" Right="FullControl"/> <AppPermissionRequest Scope="sharepoint/content/sitecollection" Right="Read"/> </AppPermissionRequests>第 2 步:使用下面的 API 获取所有站点和子站点
Step 2: Used below API to get all sites and subsites
<site_name>.sharepoint/_api/search/query?querytext='contentclass:STS_Site' &rowlimit=100我们面临的问题 –
我们参考了以下链接:
- www.ktskumar/2017/01/access-sharepoint-online-using-postman/
- docs.microsoft/en-us/sharepoint/dev/sp-add-ins/add-in-permissions-in-sharepoint
- docs.microsoft/en-us/sharepoint/dev/sp-add-ins/get-to-know-the-sharepoint-rest-service
您应该在端点中添加路径过滤器.
You should add a path filter in the endpoint.
普通网站集的路径类似于 tenant.sharepoint,而个人(One Drive)网站集的路径类似于 tenant-my.sharepoint/personal/*.
Normal site collections have a path like tenant.sharepoint whereas personal (One Drive) site collections have path like tenant-my.sharepoint/personal/*.
因此,修改您的端点如下:
So, modify your endpoint as below:
<site_name>.sharepoint/_api/search/query?querytext='contentclass:STS_Site Path:"<site_name>.sharepoint/*"'&rowlimit=500这只会返回以 <site_name>.sharepoint 路径开头的网站集,并将排除位于不同路径上的 One Drive 网站集.
This will only return site collections starting with <site_name>.sharepoint path and will exclude the One Drive site collections which are on a different path.
更多推荐
SharePoint 使用 SharePoint Online REST API 获取所有站点和所有子站点
发布评论