Enumerate All Lists Using STSADM
Hi.
In SharePoint 2007 how can I enumerate all lists in a site collection or web using STSADM?
I can see a command for example:
stsadm -o enumsubwebs -url http://myportal
but I do not see any way to enumerate all lists.
Is there a way?
August 25th, 2012 5:20am
No, there is not mechanism available for enumerating lists with stsadm.
You can access this information via the object model; either a custom .NET application or using PowerShell. James Shidell has an example of
listing all of the email-enabled lists in MOSS using PowerShell. Part of that script actually gets all the lists in the site so you could use this with minimal modification.
# Based on James Shidell's get email-enabled lists using PowerShell# http://jshidell.com/2012/01/19/getting-a-list-of-sharepoint-2007-email-enabled-document-libraries-using-powershell/
#Load SharePoint Assemblies
[System.reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint")
[System.Reflection.Assembly]::Load("Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c")
[System.Reflection.Assembly]::Load("Microsoft.SharePoint.Portal, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c")
#Next Instantiate a SPWebApplication Object
#Instantiate a SPWebApplication Object
$SPWebApp = [Microsoft.SharePoint.Administration.SPWebApplication]::Lookup(http://portal)
#Now Create a ForEach loop to loop through the SharePoint Web Applications, Sites, Subsites, and get the lists for each web
foreach ($SPsite in $SPwebApp.Sites) # Get The Collection of Site Collections
{
foreach($SPweb in $SPsite.AllWebs) # Get The Collection of Sub Sites
{
$SPweb.Lists
}
}
Jason Warren
Infrastructure Architect
Habanero Consulting Group
habaneroconsulting.com/blog
Free Windows Admin Tool Kit Click here and download it now
August 25th, 2012 4:29pm