How to get the site collection List using REST or CSOM?

Highlighted
New Contributor

Hi all,

 

we would like to get a list of all site collections using REST or CSOM with JavaScript. We used the REST call /_api/search/query? querytext=' contentclass: sts_site' &trimduplicates=false&selectproperties=' Title, SPWebUrl, WebTemplate, Description'", but not all site collections are returned.

Specially created site collections will not be returned. But even some of the site collections that have been created for a long time are not listed.


The call is done from a script in an Azure Web App. 

 

the current user is site collection administrator in all site collections.

 

Is there a reason for this?

And how can we solve this?

 

Regards,
Ralf

 

3 Replies
Highlighted

What url are you using in front of your api? are you using https://tenantname-admin.sharepoint.com/api or?

Highlighted
Highlighted

I use https://tenantname.sharepoint.com/_api/ because the user should not have access to the administration.