author | ms.author | ms.date | title | ms.localizationpriority |
---|---|---|---|---|
JeremyKelley |
JeremyKe |
09/10/2017 |
Get a SharePoint Site - OneDrive API |
Medium |
Retrieve properties and relationships for a site resource. A site resource represents a team site in SharePoint.
A site is addressed be a unique identifier which is a composite ID of the following values:
- Site collection hostname (contoso.sharepoint.com)
- Site collection unique ID (GUID)
- Site unique ID (GUID)
There is also a reserved site identifier, root
, which always references the root site for a given target, as follows:
/sites/root
: The tenant root site./groups/{group-id}/sites/root
: The group's team site.
Additionally, the root site for a particular geographic instance (for multi-geo tenants) can be accessed with the geography's dataLocationCode, as follows:
/sites/NAM
: The root site of the tenant's North American instance/sites/EUR
: The root site of the tenant's European instance
One of the following permissions is required to call this API. To learn more, including how to choose permissions, see Permissions.
Permission type | Permissions (from least to most privileged) |
---|---|
Delegated (work or school account) | Sites.Read.All, Sites.ReadWrite.All |
Delegated (personal Microsoft account) | 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
GET /sites/JPN
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
GET /sites/{site-id}
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"
}