How to bulk delete Content Type based workflow associations from a list

  • 25 November 2014
  • 0 replies
  • 18 views

Userlevel 7
Badge +10

Products: Nintex Workflow 2013, Nintex Workflow 2010

 

Today a request came in to assist in removing 9,000~ duplicate Content Type Workflow Associations from a list (previous versions). Since it did not matter whether or not any workflow associations for that content type remained on the list (it is easy enough to re-add the workflow after) this script was developed to remove all workflow associations for that content type.

 

Note: All other content type workflows (other content types) and regular list based workflows will remain unmodified.

 

Run the below (attached as well as a *.txt file for your convenience) PowerShell script (PowerShell ISE works well) from a SharePoint Server:

 

 

PowerShell Script
  1. Add-PSSnapin microsoft.sharepoint.powershell
  2.  
  3. $(Get-SPWeb http://contoso.com).lists["YourListTitle"].ContentTypes["YourContentTypeName"].WorkflowAssociations | ForEach-Object {$(Get-SPWeb http://contoso.com).lists["YourListTitle"].ContentTypes["YourContentTypeName"].RemoveWorkflowAssociation($_)}
 

 

To use the script do the following:

  • Replace http://contoso.com with the URL of the site you wish to execute the script against.
  • Replace YourListTitle with the title of the list/library you wish to execute the script against.
  • Replace YourContentTypeName with the name of the content type the workflow is attached to.

0 replies

Be the first to reply!

Reply