Wednesday, 6 November 2013

Delete persistent Site columns using powershell

Here is a list of site columns which are persistent:

    Active
    Aliases
    Article Date
    Byline
    Contact
    Contact E-Mail Address
    Contact Name
    Contact Picture
    Custom Router
    Image Caption
    Page Content
    Page Icon
    Page Image
    Priority
    Properties used in Conditions
    Property for Automatic Folder Creation
    Rollup Image
    Route To External Location
    Rule Name
    Scheduling End Date
    Scheduling Start Date
    Submission Content Type
    Summary Links
    Summary Links 2
    Target Audiences
    Target Folder
    Target Library
    Target Path

Be very sure before adding these columns to your list or content type.

To delete these site columns from your list you will need to do so by using PowerShell commands as follows:

$web = Get-SPWeb (Your site URL)
$list = $web.Lists[(Your List Name)]
$field = $list.Fields[(Your Column Name)]
$field.AllowDeletion = “true”
$field.Sealed = “false”
$field.Delete()
$list.Update()
$web.Dispose()