Delete a Site Column using PowerShell in SharePoint

Requirement: Delete site column with PowerShell in SharePoint

How to Delete a Site Column in SharePoint?

Site columns in SharePoint can be deleted when we don’t need them anymore. When you delete a site column, any lists and libraries with the particular site column don’t get affected. That site column becomes a standard list field. To remove a site column in SharePoint, navigate to:

  • Site Actions >> Site Settings
  • Click on “Site Columns” under the Web Designer Galleries section
  • On the site columns page, Click on the Title of the site column to pick the target site column
  • Scroll down and click on “Delete” button. Confirm the prompt.sharepoint 2013 powershell delete site column

Now, lets remove a site column using PowerShell!

Delete a Site Column using PowerShell in SharePoint

To delete site column using PowerShell in SharePoint, use this script:

Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue

#Variables
$RootWebURL ="http://intranet.crescent.com"

#Internal Name of the site column to delete
$SiteColumnToRemove="Departments"

#Get the Root Web
$RootWeb = Get-SPWeb $RootWebURL

#Check if a site column exists already
if ($RootWeb.Fields.ContainsField($SiteColumnToRemove))
{
     #delete site column powershell sharepoint
     $Rootweb.Fields.Delete($SiteColumnToRemove)

     Write-host "Site column has been Deleted Successfully!" 
}

This removes the site column from SharePoint site!

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!

Leave a Reply