Reputation: 603
I am attempting to retrieve all SharePoint Sites via the Microsoft Graph REST API
Looking at the Site resource, I can see there are methods to get a root site, to get subsites, but also, to get sites by group.
Are all SharePoint sites, including group sites able to be found as subsites of the root site? Or do I need to retrieve every group and enumerate those too?
Upvotes: 0
Views: 877
Reputation: 59358
To retrieve all the sites across tenant Search for sites
endpoint could be utilized, for example:
GET https://graph.microsoft.com/v1.0/sites?search=*
To retrieve only group sites indeed, it appears the only supported approach would be to:
GET https://graph.microsoft.com/v1.0/groups?$filter=groupTypes/any(c:c+eq+'Unified')&$select=id
GET https://graph.microsoft.com/v1.0/groups/{group-id}/sites/root
Upvotes: 5
Reputation: 627
No. The organization root is a sibling to group sites.
The API does have a basic search capability, if that helps. https://learn.microsoft.com/en-us/graph/api/site-search?view=graph-rest-1.0
Upvotes: 1