Home > PowerShell, SharePoint 2010 > Delete Columns From SharePoint 2010 List/Library using PowerShell

Delete Columns From SharePoint 2010 List/Library using PowerShell

There might be some cases where there are some columns in your SharePoint 2010 list or document libraries that are no longer needed,  and they need to be deleted.  However some of these columns do not have the option to delete through the List/Document Settings within SharePoint.

Time to turn to PowerShell.  Below is the script to successfully remove columns from SharePoint 2010 list/document libraries.

—————————————————————————————————————————————————–

$web = Get-SPWeb -identity http://portal/site
$list = $web.Lists[“Name of List”]
$column = $list.Fields[“Name of Column”]
$column.Hidden = $false
$column.ReadOnlyField = $false
$column.Allowdeletion = $true
$column.Sealed = $false
$column.Delete()
$list.Update()

—————————————————————————————————————————————————–

Advertisements
  1. Fran
    October 25, 2012 at 1:55 pm

    Got an error – Cannot index into a null array. trying to use it on a document library with the name “Documents”

    • October 26, 2012 at 8:36 am

      Hi Fran,

      I’m assuming you are also putting in the name of the column you want to delete within the Documents Library

      v/r
      JShidell

  2. Pratik Vyas
    June 13, 2014 at 6:37 pm

    Reblogged this on Pratik's SharePoint Blog.

  1. No trackbacks yet.

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s

%d bloggers like this: