Removing Sealed Site Columns from SharePoint Lists
- February 4th, 2013
- Posted in SharePoint
- Write comment
You may come across an issue where you need to remove a site column from a Site Content Type associated with a list, which of course is not possible using the native GUI (no remove button).
Instead you need to use the Sharepoint Management Shell to remove the offending field.
- Logon to the SharePoint Server.
- Run Sharepoint Management Shell as Administrator
- swap out the following with your information and run it in Sharepoint Management Shell.
$web = Get-SPWeb http://host.domain/sites/sitename $list = $web.Lists["List Name Here"] $field = $list.Fields["Field Name Here"] $field.AllowDeletion = “true” $field.Sealed = “false” $field.Delete() $list.Update() $web.Dispose()
If you are having issues, you can try double checking some alternate names of your field using the following:
$web = Get-SPWeb http://host.domain/sites/sitenamehere $web.AvailableFields.SchemaXml | Out-File c:\temp\fields.txt
You will be looking for the correlating Field ID of your field name. For example, if im looking for "Description", id find this string:
<Field ID="{34A72E09-3CA6-4931-B2E3-F81C40BB87BD}" Name="RoutingRuleDescription" StaticName="RoutingRuleDescription" SourceID="http://schemas.microsoft.com/sharepoint/v3" Group="Document and Record Management Columns" DisplayName="Description" Type="Text" Required="TRUE" CanToggleHidden="TRUE" Sealed="TRUE" MaxLength="255" ShowInDisplayForm="FALSE" Version="3" Description="Provide a description." />
i want to delete a "specific field" from all the documnet library available in a site collection, can you help me on this? eg: we have a custom column that is a required field for all the document library and we have arround thousands of them so using your code we can just target one library at a time but to save time we have to loop through all the document library
Sorry for the late reply. I am confident that what you outlined could be done, however, I am not a powershell guy by any stretch of the imagination. I found that code online somewhere and it was useful to my situation. Posting your request to a SharePoint forum, or maybe even stackoverflow, might put you in touch with someone who would know the correct code to achieve this. Good luck!