1

Is it possible to obtain a list of all sites in the site collection, such that it can be used e.g. in a lookup column?

So far I have found two ways of getting a display of my sites:

  1. Opening Site settings and then Site hierarchy on the top level site.
  2. Adding a content search webpart with a custom query (as described here).

While these methods are good ways to have a look at your site collection, I need a way to put together a sharepoint list for further use in workflows etc. How can that be archieved?
I am a site collection administrator and my company is running SP 2013 on premise.

Thank you for your help

1 Answer 1

0

You can use the following REST API call to get a "list of lists" on your site.

https://{site_url}/_api/web/lists

To get a list of subsites within the current Site Collection, do:

https://{site_url}/_api/web/webs

To get a list of all sites in the environment, use the Search functions of the API, the following query gets all site collections and all subsites:

https://{site_url}/_api/search/query? querytext='contentclass:STS_Site contentclass:STS_Web' &selectproperties='Title,Path'

If you just want to get top-level site collections without the subsites, just omit the contentclass:STS_Web.

If you have Workflow Services installed in order to create a workflow that uses the 2013 Workflow engine (as opposed the 2010 engine that is still the default in SP2013), then you can call this service directly from your workflow.

4
  • Thanks, but I do not need a "list of lists", but a "list of sites". Do you know how that can be archieved via REST? I have already looked into the documentation for a few hours yesterday, but so far without luck. Feb 21, 2020 at 14:20
  • I edited the answer to also include getting sites from REST API query.
    – willman
    Feb 21, 2020 at 14:29
  • Also added another option to just get subsites of the current site collection.
    – willman
    Feb 21, 2020 at 14:38
  • Thank you @willman, that looks very promising! Feb 24, 2020 at 9:05

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.