1

I've been developing some List Workflows on SPD 2010 and using the publish button to push them to the webserver. Everytime I publish a new version, the previous one gets labeled 'Previous Versions'.

Now, when I go to the Workflow Settings for that list, I can find at least a hundred workflows, most of them Previous Versions. If I check the workflows tab on SPD 2010 I only find the current version of my workflows.

Is there a way to remove all those previous versions from the Server?

  • I have not worked with workflows in a long time but I remember vaguely. You should be able to remove the previous versions from the workflow settings page. – Nitin Rastogi Dec 26 '11 at 6:29
  • Is there a way to do this via UI instead of powershell? – Emon Jan 8 '14 at 21:58
4

It should be possible using Powershell.

  1. You need to open the site and get the list.
  2. Iterate through list workflow association and remove whichever is not required.
  3. Sample code might look like below:

Powershell:

$web = Get-SPWeb "Web URL"
$listToCancel = "List Name"
$wfToKeep = "Workflowname"

$list = $web.Lists[$listToCancel]
$tempList = New-Object "System.Collection.Generic.List[System.Object]"

foreach ($wf in $list.WorkFlowAssociations) {
    if ($wf.Name -ne $wfToKeep) { 
        $tempList.Add($wf); 
    }
}
foreach ($wf in $tempList){ 
    $list.RemoveWorkflowAssociation($wf); 
}
  • Excellent script. This helped me. – Kannan Sep 16 '12 at 8:15
4

There is a simple way to remove the Previous Versions of a workflow after you publish a workflow:

  1. Click List Settings
  2. Click Workflow Settings
  3. Click Remove a Workflow
  4. Select the radio button under the Remove column for every "Previous Version" item.
0

There is also a browser based approach to this in SP Online:

https://YOURSUBDOMAIN.sharepoint.com/sites/YOURSITE/_layouts/15/RemWrkfl.aspx?List={LIST-GUID}

This will present you with a visual representation of all older 2010 or 2013 workflow versions, even when working in current instances of SP Online.

You can now select which versions are allowed for any newly created item or you can choose to remove versions...

enter image description here

0

So, I had an issue with the script provided above because I have multiple workflows on this list. So I searched for the "Previous Version" tag instead:

Add-PsSnapin Microsoft.SharePoint.PowerShell
$web = Get-SPWeb 'WEB URL'

$listToCancel = "LIST NAME"

$list = $web.Lists[$listToCancel]

$tempList = New-Object "System.Collections.Generic.List``1[System.Object]"

foreach ($wf in $list.WorkFlowAssociations) {

if ($wf.Name -like '*(Previous Version:*') { $tempList.Add($wf); }

}

foreach ($wf in $tempList){ $list.RemoveWorkflowAssociation($wf);}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.