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 doesn't get affected. Those site column becomes standard list field. To remove a site column in SharePoint, Navigate to:
  • Site Actions >> Site Settings
  • Click on "Site Columns" under Web Designer Galleries section
  • In Site columns page, Click on the Title of the site column to pick 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

$RootWebURL =""

#Internal Name of the site column to delete

#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

        Write-host "Site column has been Deleted Successfully!" 
This removes the site column from SharePoint site!

No comments:

Please Login and comment to get your questions answered!

Powered by Blogger.