Cannot Delete Site Columns from Document Library or Content Type

Recently I ran into an issue where one of the SharePoint users added an existing site column called “Active” into one of the document libraries and was not able to remove it. This is a strange behavior from SharePoint and is because some “AllowDeletion” field property is set to true by default. Anyway, I was able to delete the filed using the following PowerShell script.

$web = Get-SPWeb https://siteurl/
$list = $web.Lists["Shared Documents"]
$field = $list.Fields["Active"]
$field.AllowDeletion = “true”
$field.Sealed = “false”

In this case, the column was added only to the Document Library; not to the site content type. If these types of columns were added to site content types, you could use the following script.

$web = Get-SPWeb http://siteurl/
$ct = $web.ContentTypes["Document"]
$spFieldLink = New-Object Microsoft.SharePoint.SPFieldLink($web.Fields["Active"])

Thanks to Brendan Well’s blog which saved me a lot of time.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s