Forum Discussion
Charles Willwerth
Nov 30, 2016Brass Contributor
Find all lists name x in a site collection
I have a SharePoint Online site collection with ~1000 subsites (through about 4 levels). About 70% of the subsites have a specifically named task list I'd like to routinely cleanout.
Right now, I'm doing this by looping through all the Webs. Is there a way to get these lists without looping through? A way to find all lists name "xyz" given a Site object (or Web object I guess)?
2 Replies
- Kiril IlievBrass ContributorYou can do this with the search REST API (GET request): https://tenant.sharepoint.com/sites/sitecollection/_api/search/query?querytext='STS_LIST_Tasks AND Path:"https://tenant.sharepoint.com/sites/sitecollection"'
This query will return all lists of type Tasks which are part of the site collection. - AnonymousIt is only possible if you use search i guess