Monday, 17 January 2011

Delete unused workflow status columns in SharePoint list views using PowerShell

SharePoint 2010 seems to be better than 2007 for removing workflow status columns from list views after a workflow has been removed or updated, but it does still leave them behind every now and again.


I have been unable to trace exactly why this happens, but rather than waste time looking, I decided to write a quick PowerShell script to remove these columns as they cannot be deleted from the UI.

This script works as a function – meaning that there are two parts to running it in the SharePoint 2010 Management Shell. First, you have to run the script shown 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

    #Delete column and dispose of the web object
    write-host "Deleted column"

Once the function has been run, you can call it to actually remove a column with the following command:

Delete-WorkflowColumn -webURL http://portal -listName "Documents" -columnName "Approval Workflow (Previous Version:1/17/2011 8:45:01 PM)"

The example above deletes the “Approval Workflow (Previous Version:1/17/2011 8:45:01 PM)” column shown in the screenshot above from all list views of a document library called “Documents” in the site http://portal.

Whilst I have focused in this article on removing columns generated by unused workflows, you can use exactly the same script to remove columns from any list or document library.


  1. Nice.

    Or you can use SharePoint Manager and set AllowDeletion property of the field to True and delete the field...

  2. This is awesome I spend all morning tring to do this!!!

  3. Grateful to check out your website, I seem to be ahead to more excellent sites and I wish that you wrote more informative post for us. Well done work.

  4. Even ought to had a service thats generally injured, Flawed or it may be incorrect exercise programs planned advent, Remember let us know routinely but also i will try to unravel the situation in a timely manner. An satisfaction is related with top rated great to our business and therefore some of us achievable 2 days within the wedding this day performance to assert this challenge. An old 30 day come home quote will definately add if the thing is accounted and afterward 2 days from your time concerning execution..

    This Maillot De Foot Pas Cher excellent Maglie Da Calcio a Poco Prezzo price will involve appropriate manners equipement foot jobs, Place a burden on, Stock dfb trikot müller broker nicely as other fees and penalties. Such a multitude is be hummel trikots more responsive to change before Coach Outlet Online Store make compensation. For vacationer tax, See the Camisetas De Futbol Baratas world shipping charges technique affiliate agreement breaks in a whole maillot de foot pas cher pickup's wind shield manuel neuer trikot rot and / or maybe hook.

    The product may just amazon müller trikot be lack of an original selling label chemicals(In particular authentic box or ticket). Fresh original manufacturing unit moments and/or excessive collectibles might second category now this situation area. The tickets might not be included.

  5. Kendrick Henley was one of six CNN viewers chosen to official coach outlet online be a part of the Coach Factory Outlet Store 2011 Fit Nation Triathlon Challenge. He trained with Dr. Sanjay Gupta and raced the New York City Triathlon on August 7. Since then Henley has kept up his new healthy lifestyle and recently raced his second 5K since the triathlon. CNN is looking for viewers like Henley to join our 2012 Challenge. Click Your Story to apply.

    The year 2011 might be coming to an end, but Kendrick's journey and Team Henley's celebrations continue.

    When Kendrick, Coach Keith and I (Coach Mary Ann) became "Team Henley" in January 2011, none of us knew what coach factory outlet online login to expect from the coming year. Kendrick had just been selected for the 2011 Fit Nation Challenge and Coach Keith and I were excited to have the opportunity to coach a new athlete from our hometown of Chicago.

    That was pretty much all that we knew, and out of the three of us, Kendrick was taking the biggest risk. He was literally letting the world know that he coach factory website wanted to change the way he was living, lose weight and take on a healthier lifestyle.

    The timing was great for me, because in a moment of insanity I had made an annual check up appointment for the Monday morning after Thanksgiving. Surprise surprise: my weight was up.

    In an attempt to distract my kind doctor from that coach factory online sale issue, I mentioned that I was entering a contest coach factory outlet to do the NYC Triathlon, and Iasked if she thought I was healthy enough to do it.

    I have to hand it to her if she rolled her eyes, it was so subtle that I didn't notice cheap coach purses it. She allowed that since I had recently completed two uneventful 5K races, I would probably be fine to do a triathlon (not that she really believed I would do it).

    My second triathlon was a huge success. Now it your turn!

  6. There are those who want to collect vintage items like Michael Kors Factory Outlet with genuine and high quality leathers from Michael Kors. To be able to grab a quality Michael Kors Bags Outlet item of your choice, make sure to be very careful in selecting what to buy, how to buy and where to buy the Michael Kors Outlet Online.