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, and that site column becomes a standard list field. This blog post will show you how to delete a site column in SharePoint, and we’ll also show you how to delete a site column using PowerShell in SharePoint.

To remove a site column in SharePoint, follow these steps:

  • 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

Keep in mind that once a site column is deleted, it cannot be recovered. So be sure to backup before deleting. Now, let’s 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 ="https://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 the SharePoint site! This can be helpful if you want to quickly clean up your site by removing a column that is no longer needed or in case you need to bulk delete site columns.

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