Getting Microsoft SharePoint Sites

You can get a resource representation of an organization sites.

Request

GET https://<hostname>:4443/v6/Organizations/{organizationId}/Sites?includePersonalSites=<boolean>&parentId=<string>&locationFilter=<string>

Request Headers

The request header must contain an authorization token of the current session.

Request Parameters

The following parameter must be specified in the URL of the request:

Parameter

Type

Description

organizationId

string

Specifies the identification number of the Microsoft 365 organization. For more information on how to get this parameter, see Getting Organizations.

The following optional parameters can be specified in the URL of the request:

Parameter

Type

Description

includePersonalSites

boolean

Defines whether the personal sites are included to the resource representation that will be returned to the client. The following values are available:

  • true — the server returns properties of personal sites.
  • false — the server does not return properties of personal sites.

The default value is false.

parentId

string

Specifies what information the server will return in the resource representation. The following values are available:

  • <parentID> — ID of the SharePoint site. In the response, the server will return a representation of subsites for the specified top-level site.
  • null — specifies that the server will return a representation of all top-level SharePoint sites of the organization without their subsites.

If you do not specify this parameter, the server will return a representation of all top-level SharePoint sites with their subsites. Thus, the server will require longer time to execute the request.

locationFilter

string

Note: Use this parameter for organizations of the Hybrid type.

Specifies an organization site location type. The following types are available:

  • Cloud
  • OnPremises
  • Any

Request Body

None.

Response

The server returns the following response to the client.

Response Codes

A successfully completed operation returns a response code 200 OK.

Response Headers

The response to this request contains the following headers. The response may also include additional standard HTTPS headers.

Header

Description

Content-length

The length of the response body.

Content-type

The media type and syntax of the response body message: application/json; charset=utf-8

Response Body

In the response body, the server returns a resource representation of the /Organizations/{organizationId}/Sites collection resource.

Example

The example returns a list of organization sites excluding personal sites for an organization with the specified ID.

Request:

GET https://abc.tech.local:4443/v6/Organizations/e60dfb9c-ac58-4463-879f-9855ac35576b/Sites

 

Request Header:

Authorization: Bearer <Access-Token>

 

Response:

200 OK

 

Response Body:

{

 "offset": 0,

 "limit": 30,

 "_links": {

   "self": {

     "href": "/v6/Organizations/e60dfb9c-ac58-4463-879f-9855ac35576b/Sites?offset=0&limit=30&setid=7911c646-89e6-4fea-85bb-16918ea7944d"

   },

   "next": {

     "href": "/v6/Organizations/e60dfb9c-ac58-4463-879f-9855ac35576b/Sites?offset=30&limit=30&setid=7911c646-89e6-4fea-85bb-16918ea7944d"

   }

 },

 "results": [

   {

     "id": "62063220-8cf8-420e-b23f-bb0d3967809eea3c612f-1037-4015-be8b-2d9c96e557d1",

     "url": "https://abc.sharepoint.com/sites/abc-site1",

     "name": "abc-site1",

     "isCloud": true,

     "isPersonal": false,

     "title": "ABC Site1",

     "isAvailable": true,

     "_links": {

       "self": {

         "href": "/v6/organizations/e60dfb9c-ac58-4463-879f-9855ac35576b/sites/62063220-8cf8-420e-b23f-bb0d3967809eea3c612f-1037-4015-be8b-2d9c96e557d1"

       },

       "children": {

         "href": "/v6/organizations/e60dfb9c-ac58-4463-879f-9855ac35576b/sites?parentId=62063220-8cf8-420e-b23f-bb0d3967809eea3c612f-1037-4015-be8b-2d9c96e557d1"

       },

       "organization": {

         "href": "/v6/organizations/e60dfb9c-ac58-4463-879f-9855ac35576b"

       }

     }

   },

   {

     "id": "0cff8a27-3962-4289-b10e-a2e5bea6faa44c93ac7c-5678-41b0-b18a-0854e691e687",

     "url": "https://abc.sharepoint.com/sites/abc-site2",

     "name": "abc-site2",

     "isCloud": true,

     "isPersonal": false,

     "title": "ABC Site2",

     "isAvailable": true,

     "_links": {

       "self": {

         "href": "/v6/organizations/e60dfb9c-ac58-4463-879f-9855ac35576b/sites/0cff8a27-3962-4289-b10e-a2e5bea6faa44c93ac7c-5678-41b0-b18a-0854e691e687"

       },

       "children": {

         "href": "/v6/organizations/e60dfb9c-ac58-4463-879f-9855ac35576b/sites?parentId=0cff8a27-3962-4289-b10e-a2e5bea6faa44c93ac7c-5678-41b0-b18a-0854e691e687"

       },

       "organization": {

         "href": "/v6/organizations/e60dfb9c-ac58-4463-879f-9855ac35576b"

       }

     }

   },

}

 ],

 "setId": "7911c646-89e6-4fea-85bb-16918ea7944d"

}