Created
August 6, 2013 06:08
-
-
Save mikeplate/6162420 to your computer and use it in GitHub Desktop.
Find all Content Types and Lists where a particular column is used within a site collection
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| param ( | |
| [String]$SiteUrl = 'http://spdev', | |
| [String]$FieldName = 'Title' | |
| ) | |
| Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue | |
| $site = Get-SPSite $SiteUrl | |
| "Showing where ""$FieldName"" is used" | |
| foreach ($web in $site.AllWebs) { | |
| foreach ($ctype in $web.ContentTypes) { | |
| if ($ctype.Fields.ContainsField($FieldName)) { | |
| $web.Url + ' Content Type: ' + $ctype.Name | |
| } | |
| } | |
| foreach ($list in $web.Lists) { | |
| if ($list.Fields.ContainsField($FieldName)) { | |
| $web.Url + ' List: ' + $list.Title | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment