Enumerate All Lists Using STSADM RRS feed

  • Question

  • 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?

    Thursday, August 23, 2012 9:43 AM


  • 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=, Culture=neutral, PublicKeyToken=71e9bce111e9429c") [System.Reflection.Assembly]::Load("Microsoft.SharePoint.Portal, Version=, 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

    Friday, August 24, 2012 8:35 PM