Find SharePoint Site Column Usage – Report

When trying to delete a SharePoint site column, it gave me an alert saying “Site columns which are included in content types cannot be deleted. Remove all references to this site column prior to deleting it.” 

sharepoint find field usage

Alright, Lets use PowerShell to find what lists or content types are using a particular site column, before deleting it.

PowerShell script to Find and delete a site column from Content type

Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue

$web= Get-SPWeb ""
$ColumnInternalName = "BranchLocation"

#Get All Content Types
$CTypes = $
foreach($ContentType in $CTypes)
  $FieldInUse = $ContentType.FieldLinks | Where {$_.Name -eq $ColumnInternalName }
   if($FieldInUse -ne $null) 
            Write-Host "Found the Column in Content Type:" $ContentType.Name -ForegroundColor DarkGreen
            #To Remove the field from content type, uncomment below two lines

Done! Again when trying to delete the site column, received “This site column will be removed and all list columns which were created from it will be permanently orphaned. Are you sure want to delete this site column?”

sharepoint find site column usage

Well, What does it means? Site columns are created to minimize duplicates and to provide consistency. So, if we delete a site column, all list/library columns created will continue to hold their values. There will not be any impact on the data. But they’ll become local columns. Alright, Before deleting a site column lets see where it s actually being used? Lets Find all references of our Site Column in a particular site collection using PowerShell.

PowerShell script to Find a Site column usage on Lists

Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue

#Site URL
$SiteURL = ""
#Column to search
$ColumnInternalName = "BranchLocation"

#Get the Web
$Site = Get-SPSite $SiteURL
#Get the Column
$column = $site.RootWeb.Fields.GetFieldByInternalName($ColumnInternalName)

#Find all List usages of the column
$SiteColumnUsages = $column.ListsFieldUsedIn() #Gets the WebID & ListID values

#Get the lists where the site column is being used
foreach( $Usage in $SiteColumnUsages )
        $Site.AllWebs | foreach {$_.Lists} | where {$_.ID -eq $Usage.ListID } | Select Title, ParentWebURL, RootFolder
Write-Host "Checking Lists to Remove the Site column..."
foreach( $Usage in $SiteColumnUsages )
   #Remove columns from Lists where its used 
   $List =  $Site.AllWebs | foreach {$_.Lists} | where {$_.ID -eq $Usage.ListID } 
      $field = $List.Fields.GetFieldByInternalName($ColumnInternalName)

      ## Uncomment these four lines to actually delete a site column from Lists
      #$field.AllowDeletion = $true
      Write-Host "Site column $($ColumnInternalName) has been removed from $($List.RootFolder) at $($List.ParentWeb.URL)"

Salaudeen Rajack

Salaudeen Rajack is a SharePoint Architect with Two decades of SharePoint Experience. He loves sharing his knowledge and experiences with the SharePoint community, through his real-world articles!

4 thoughts on “Find SharePoint Site Column Usage – Report

  • Do you have CSOM version ?

  • Do you have this in a CSOM version?

  • where did you declare $Usage


Leave a Reply