1

I want to display all site collections for a given web application(Can be hard-coded url) using JSOM SharePoint 2010(No REST api). I have tried but couldn't complete it.

1 Answer 1

4

The JS CSOM only operates on the site you are currently on (You can open another client context but you need a site URL to do so). It does not allow you to do any operations based on the webapp level. If you want to execute those statements you need to user other ways.

A nice and simple approach would be to query the search via REST. You can apply a filter to only retrieve Sitecollections and you can also filter by path.

A filter for Sitecollections can be don't via the contentclass managed property with a value of sts_site.

Have a look here for some values you can use:
https://blogs.msdn.microsoft.com/mvpawardprogram/2015/02/16/sharepoint-power-searching-using-contentclass/

3

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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