Skip to main content

Posts

Showing posts from June, 2018

Delete a SharePoint list Field(Column) using PowerShell

Delete a SharePoint list Field(Column) using PowerShell Hello folks, The following is a code snippet from PowerShell to completely remove or delete a field in a SharePoint list. The code uses the GUID to find the field (column). I tested this with SharePoint 2013. Approch #1 #Set-ExecutionPolicy RemoteSigned [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint")    Get-PSSnapin –Registered Add-PSSnapin Microsoft.SharePoint.PowerShell  #Variables $SiteURL="xxxxxxxxx" $ListName="News" $ColumnName="WikiPlus"   #Get Internal Name of the columns $web = Get-SPWeb $SiteURL   #Get the list $list = $web.Lists.TryGetList($ListName)   if($List -ne $null) {     #Get the column      $column = $list.Fields[$ColumnName]       if($column -ne $null)     {         #Reset column properties to allow delete         $column.Hidden = $false         $column.ReadOnlyField = $false