Monday, January 25, 2010

how to find out name of list who have particular custom column

iterate through all sites and list

[void][System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint")
$spSite = New-Object Microsoft.SharePoint.SPSite("http://url")
$webApp = $spSite.WebApplication
foreach ($site in $webApp.Sites) {
    foreach ($web in $site.AllWebs) {
        foreach ($list in $web.lists) {
            if ($list.fields["Custom Field name"]) {
                "List has custom field" | Out-File C:\filePath\log.txt -append
            }
        }
    }
}