I am going to describe how to delete unwanted or orphaned workflow column from a List.it can be done simply by writing few lines of powershell command as below.
- function Delete-WorkflowColumn ($webURL, $listName, $columnName)
- {
- #Setup variables from the user input
- $web = Get-SPWeb $webURL
- $list = $web.Lists[$listName]
- $column = $list.Fields[$columnName]
- #Make sure the column is not hidden or read only
- $column.Hidden = $false
- $column.ReadOnlyField = $false
- $column.Update()
- #Delete column and dispose of the web object
- $list.Fields.Delete($column)
- write-host "Deleted column"
- $web.Dispose()
- }
-
-
- Delete-WorkflowColumn -webURL http://ServerName/ -listName "ERP Request" -columnName
-
- "Approval Workflow"
save above notepad with the name of delete.ps1 and then from powershellscript do as below
- PS D:\> .\delete.ps1
- Deleted column
- PS D:\>