Posts Tagged 'site collection'

Finding out where a list column is used in a site collection

There are times when you need to know where a specific list column is being used in your site collection. This is especially true for custom columns that you may have created. The following script can be used to find which lists are using a specific column name. (I posted this script on the SharePoint TechNet forum in response to a question.)


[System.Reflection.Assembly]::Load("Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c") | out-null

[void][System.reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint")

# set-up working variables...

# Enter your SharePoint site collection URL here...

$TargetSiteUrl = "http://sharepoint_site_collection_URL"

# Enter the list column name you want to find here...

$FieldToFind = "Title"

# Starting search

write-host "FieldName, ListName, ListURL"

$spSite = new-object Microsoft.SharePoint.SPSite($TargetSiteUrl)

$colWebsites = $spSite.AllWebs

foreach ($web in $colWebsites)
{

$colLists = $web.Lists

foreach ($list in $colLists)
{

$fields = $list.Fields

foreach ($item in $fields)
{

If ($item.Title.Contains($FieldToFind))
{
write-host  $item.Title, ";", $list.Title, ";", $list.DefaultViewUrl
}

}

}

}

write-host "Finished."


RSS Information Week Headlines

  • An error has occurred; the feed is probably down. Try again later.

RSS SharePoint Team Blog

  • An error has occurred; the feed is probably down. Try again later.

RSS InfoPath Team Blog

  • An error has occurred; the feed is probably down. Try again later.

RSS Joel Oleson Blog

  • An error has occurred; the feed is probably down. Try again later.

RSS Bud Ratliff blog

  • An error has occurred; the feed is probably down. Try again later.

RSS Susan Hanley’s KM Blog

  • An error has occurred; the feed is probably down. Try again later.

Blog Stats

  • 401,900 hits