We can
access the site collection using three different ways in Microsoft Graph API:
Get
SharePoint site collection by using ‘root’
The root
parameter next to the sites denotes the default and top-level site collection.
https://graph.microsoft.com/v1.0/sites/root
Get
SharePoint site collection using the Site ID
If we have
the unique ID of the site collection, we can retrieve it by specifying site ID next to the sites.
https://
graph.microsoft.com/v1.0/sites/<siteid>
Example:
https://
graph.microsoft.com/v1.0/sites/298ada92-042b-4bf3-ae87-3b207baf17dc
Get
SharePoint site collection by using the server relative URL
https://graph.microsoft.com/v1.0/sites/<host>:<server relative
url>
Example
https://graph.microsoft.com/v1.0/sites/ktsdemo.sharepoint.com:/sites/demos
Get
SharePoint site collection using the Group ID
If the
SharePoint site collection is created based on an Office 365 group, we can use the
below endpoint to retrieve the top-level site.
https:// graph.microsoft.com/v1.0/groups/<group-id>/sites/root
Example:
https://
graph.microsoft.com/v1.0/groups/
298ada92-042b-4bf3-ae87-3b207baf17dc/sites/root