Enumerate sites
List the available sites in an organization that match provided filter criteria and query options.
Only the following query options are currently supported:
Filter statement | Select statement | Description |
---|---|---|
siteCollection/root ne null |
siteCollection,webUrl |
Lists all root-level site collections in the organization. Useful for discovering the home site for each geography. |
In addition, you may use a search query against the '/sites' collection to find sites matching given keywords.
Permissions
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 |
HTTP request
GET /sites?filter=siteCollection/root ne null
Example
Request
GET /sites?select=siteCollection,webUrl&filter=siteCollection/root%20ne%20null
Response
HTTP/1.1 200 OK
Content-type: application/json
{
"value": [
{
"id": "contoso.sharepoint.com,da60e844-ba1d-49bc-b4d4-d5e36bae9019,712a596e-90a1-49e3-9b48-bfa80bee8740",
"name": "Contoso USA",
"root": { },
"siteCollection": {
"hostname": "contoso.sharepoint.com",
"dataLocationCode": "NAM",
"root": { }
},
"webUrl": "https://contoso.sharepoint.com"
},
{
"id": "contoso-jpn.sharepoint.com,da60e844-ba1d-49bc-b4d4-d5e36bae9019,0271110f-634f-4300-a841-3a8a2e851851",
"name": "Contoso Japan",
"root": { },
"siteCollection": {
"hostname": "contoso-jp.sharepoint.com",
"dataLocationCode": "JPN",
"root": { }
},
"webUrl": "https://contoso-jp.sharepoint.com"
}
]
}