Monday, 22 May 2017

Quick tip - Get all the empty lists and libraries from SharePoint environment using Search

There might be scenarios when you want to identify all the empty list and libraries from your SharePoint environment for general administration / governance reporting / pre-migration clean-up purposes Instead of writing long running scripts looping through the Site Collections and lists, this data can be found quickly using SharePoint search.

Out of the box, there is a crawled property and a managed property in SharePoint that indicate whether a list is empty or not

Crawled property  : ows_IsEmptyList
Managed property : IsEmptyList



By default, the managed property "IsEmptyList" is not Queryable. To be able to query for the empty list data, create a Queryable custom managed property and map the crawled property "ows_IsEmptyList". I have created a managed property called EmptyListFlag




















Now using the good old Search Query Tool, I could retrieve all the empty lists in my SharePoint environment. The results will also have some Out of the box lists and libraries which can be excluded through the query or while processing the results.


























PS : I have tested this only against SharePoint online only !

No comments:

Post a Comment