1

I need to loop through all site collection in a web app and I have to extract the list name called "Project Center" and list down all the list properties. Help required.

1 Answer 1

2

This should do it

$spWebApp = Get-SPWebApplication "http://myapplication.sharepoint.com/"

function getListProperties ($spweb)
{
    foreach ($spList in $spweb.Lists | Where {$_.Title -eq "Project Center"})
    {
        Write-Host "List found in: $($spweb.Url)"
        $spList.PSObject.Properties | Select-Object Name,Value
    }

    foreach ( $subweb in $spweb.Webs)
    {
        getListProperties $subweb
    }

    $spweb.Dispose()
}


foreach ($spSite in $spWebApp.Sites)
{
    Write-Host "Looking in $($spSite.Url)..."
    $rootWeb = $spSite.RootWeb
    getListProperties $rootWeb
}

Don't forget to replace the spweb application URL with your SharePoint URL.

3
  • Am getting the following errrors: You cannot call a method on a null-valued expression.;;The term 'Get-SPWebApplication' is not recognized as the name of a cmdlet, function, script file, or operable program. ;;;'getListProperties' is not recognized as the name of a cmdlet. Am unable to solve these errors.(I have replaced the webapp url).
    – priya
    Jan 2, 2014 at 4:49
  • Make sure you are running this in the sharepoint management shell so that the sharepoint snapin is already loaded.
    – BlueBird
    Jan 2, 2014 at 13:51
  • Hi, the above code worked for me for retrieving list prperties using powershell. I need one more help for display the list properties by exporting it to .csv(export in excel). suggestions are welcome. thanks
    – priya
    Jan 7, 2014 at 10:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.