0

I'm looking to see how to get a list of all the site collections. This is to make it easy for users to just come to the root, and see links to all their site collections. I've figured how how to get all the subsites thru an API call, but am struggling with getting all the site collections. I should note that I'm using 2016 on-prem. Appreciate any suggestions...

1

Yes the search api is your best bet as mentioned by @Amos_MSFT, this will return all Site Collections for all web applications that are crawled by the search center you are running the query against (if you have multiple). It will also be security trimmed, so if you have a secret site collection the user doesn't have access to they won't see it in their list.

Query this the same as you would the standard REST Api, get the results loop through and display.

0
2

You could use search api:

/_api/search/query?querytext='contentclass:sts_site'

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.