Tuesday, February 1, 2011

How to Remove a sealed column in SharePoint 2010 using powershell or sharepoint manager.

Last week when I was working with a sharepoint list, I needed to add a page content field for testing purposes. After  sometime I wanted to remove it.
Strangely I couldn’t do that. Typically when you want to remove a field to a list in sharepoint web frontend, you can easily do that by
1.       go to the list settings
2.       click on particular field in the list
3.       then click on the remove button in the left hand side. (near OK,Cancel) button.

But this time I couldn’t do that.  After spending some time and thanks for my mate Diluk, I figured it out what should be done.
When you add a page content field it will created as sealed column and by default sharepoint doesn’t allow to delete sealed columns.

For that we can use either Sharepoint powershell commands or Sharepoint Manager.

Using Powershell Commands
The following steps provide the way to remove it using powershell commands.
1.       Run SharePoint 2010 Management Shell as administrator. SharePoint 2010 Management Shell can be found under the Microsoft SharePoint 2010 Products in start menu.
2.       Connect to the site
$site
$web = $site.RootWeb
$web
$list = $web.Lists["topics"]
$list
$field = $list.Fields["Page Content"]
$field
After this you need to  set the field properties “Allowdeletion” to true and “Sealed” to false

$field.Allowdeletion = $true
$field.Sealed = $false

Then you can delete the field

$field.Delete()

Make sure to update the list after deletion

$list.Update()

Now you are done!

Using Sharepoint Manager Tool

1.       Run the Sharepoint Manager Tool in your machine (you can download it here)
2.       Go to Content Service -> Web Applications -> Your Site -> Site Collection -> Your Site Collection Url -> Fields
3.       Expand the Field list and select the relevant field
4.       On the right hand side pane you can see the field properties.
5.       Find AllowDeletion property and set it to true.
6.       Find Sealed property and set it to false.
7.       Then right click on the field on the left pane and click Delete.
8.       That’s it!

1 comment:

  1. Thank you for sharing such an informative article. I really hope I can see other interesting posts. Keep up the good work!


    ReplyDelete