Thursday, 23 June 2016

Display all the lists in a SharePoint Site collection

This is a very simple set of code in PowerShell to find all the lists in SharePoint which are not default/hidden for all web sites under a site collection.


http://contoso.sharepoint.com


$spSite = Get-SPSite -Identity http://contoso.sharepoint.com

$spWebs = $spSite.AllWebs




Get-Date


foreach($spWeb in $spWebs)



{

$spWebTitle = $spWeb.Title

"Displaying Lists in Site::"+$spWebTitle

$spLists = $spWeb.Lists

foreach ($spList in $spLists)



{

$spList.Title



}

"List Count in site ::"+$spWebTitle + "::" + $spLists.Count

#Get-Date;



}



No comments:

Post a Comment