Home

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

Ralf Friedrich
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

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

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

Related Conversations
Tabs and Dark Mode
cjc2112 in Discussions on
35 Replies
Extentions Synchronization
ChirmyRam in Discussions on
3 Replies
flashing a white screen while open new tab
Deleted in Discussions on
14 Replies
Stable version of Edge insider browser
HotCakeX in Discussions on
35 Replies