Find all lists name x in a site collection

Brass Contributor

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
It is only possible if you use search i guess
You 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.