Monday, 22 July 2013

Remove a SharePoint column in PowerShell

I was trying to remove an existing column from a list through the UI without any success. The solution lay in removing it through the 'back end' with my good friend PowerShell.

Here is the code:

$web = Get-SPWeb -identity http://your/site/name
$list = $web.Lists["Your List Name"]
$column = $list.Fields["Your Column Name"]
$column.Hidden = $false
$column.ReadOnlyField = $false
$column.Update()
$list.Fields.Delete($column)

No comments:

Post a comment