Events
Mar 17, 9 PM - Mar 21, 10 AM
Join the meetup series to build scalable AI solutions based on real-world use cases with fellow developers and experts.
Register nowThis browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Namespace: microsoft.graph
Important
APIs under the /beta
version in Microsoft Graph are subject to change. Use of these APIs in production applications is not supported. To determine whether an API is available in v1.0, use the Version selector.
Retrieve properties and relationships for a site resource. A site resource represents a team site in SharePoint.
Choose the permission or permissions marked as least privileged for this API. Use a higher privileged permission or permissions only if your app requires it. For details about delegated and application permissions, see Permission types. To learn more about these permissions, see the permissions reference.
Permission type | Least privileged permissions | Higher privileged permissions |
---|---|---|
Delegated (work or school account) | Sites.Read.All | Sites.ReadWrite.All |
Delegated (personal Microsoft account) | Not supported. | Not supported. |
Application | Sites.Read.All | Sites.ReadWrite.All |
To access the root SharePoint site within a tenant:
GET /sites/root
GET /sites/contoso.sharepoint.com
If you have the server-relative URL for a site resource, you can construct a request as follows:
GET /sites/{hostname}:/{server-relative-path}
To access the team site for a group:
GET /groups/{group-id}/sites/root
The following example shows a request that gets a site by its site ID. A site ID is the value of the id property of its site resource. For more information on the format of the site ID, see site.
GET https://graph.microsoft.com/beta/sites/contoso.sharepoint.com,2C712604-1370-44E7-A1F5-426573FDA80A,2D2244C3-251A-49EA-93A8-39E1C3A060FE
The following example shows the response.
HTTP/1.1 200 OK
Content-type: application/json
{
"id": "contoso.sharepoint.com,2C712604-1370-44E7-A1F5-426573FDA80A,2D2244C3-251A-49EA-93A8-39E1C3A060FE",
"owner": {
"user": {
"displayName": "Daron Spektor",
"id": "5280E7FE-DC7A-4486-9490-E790D81DFEB3"
}
},
"displayName": "OneDrive Team Site",
"name": "1drvteam",
"createdDateTime": "2017-05-09T20:56:00Z",
"lastModifiedDateTime": "2017-05-09T20:56:01Z",
"webUrl": "https://contoso.sharepoint.com/teams/1drvteam"
}
The following example shows a request that gets a site by its hostname and server relative path.
GET https://graph.microsoft.com/beta/sites/contoso.sharepoint.com:/teams/1drvteam
The following example shows the response.
HTTP/1.1 200 OK
Content-type: application/json
{
"id": "contoso.sharepoint.com,2C712604-1370-44E7-A1F5-426573FDA80A,2D2244C3-251A-49EA-93A8-39E1C3A060FE",
"displayName": "OneDrive Team Site",
"name": "1drvteam",
"createdDateTime": "2017-05-09T20:56:00Z",
"lastModifiedDateTime": "2017-05-09T20:56:01Z",
"webUrl": "https://contoso.sharepoint.com/teams/1drvteam"
}
The following example shows a request that gets a group's site by the id property of a group.
GET https://graph.microsoft.com/beta/groups/2C712604-1370-44E7-A1F5-426573FDA80A/sites/root
The following example shows the response.
HTTP/1.1 200 OK
Content-type: application/json
{
"id": "contoso.sharepoint.com,2C712604-1370-44E7-A1F5-426573FDA80A,2D2244C3-251A-49EA-93A8-39E1C3A060FE",
"displayName": "OneDrive Team Site",
"name": "1drvteam",
"createdDateTime": "2017-05-09T20:56:00Z",
"lastModifiedDateTime": "2017-05-09T20:56:01Z",
"webUrl": "https://contoso.sharepoint.com/teams/1drvteam"
}
Events
Mar 17, 9 PM - Mar 21, 10 AM
Join the meetup series to build scalable AI solutions based on real-world use cases with fellow developers and experts.
Register now