1

Is it possible to disable Workflow 2010 programmatically in SharePoint Online?

Workflows 2010 engine is not yet disabled at our tenant and will work until at least December 2021. As a result, we still have many SPD 2010 workflows that will need to be recreated using Power Automate. We would like to start disabling SPD 2010 workflows preemptively. This way we will know if anyone uses them.

So far I could not find a way to automate the process of disabling SPD 2010 Workflows. I will really appreciate any suggestions.

1 Answer 1

2

Run the following Powershell script as an administrator::

$url = "https://test.sharepoint.com/sites/projects";
$userName = "[email protected]"
$password = "*******"

$cred = New-Object -TypeName System.Management.Automation.PSCredential -argumentlist $userName, $(convertto-securestring $Password -asplaintext -force)

Function Disable-WorkflowAssociations($url,$cred)
{
   try{
      $context = New-Object Microsoft.SharePoint.Client.ClientContext($url)
      $context.Credentials = $cred
      $AllLists=$context.Web.Lists
      #GetBYTitle can also be used
      $list=$AllLists.GetById("#Idhere") 
      $context.Load($list.WorkflowAssociations)
      $context.ExecuteQuery()
      foreach($wfAssociation in $list.WorkflowAssociations) {

         $wfAssociation.Enabled=$false
         $wfAssociation.Update()
         $context.ExecuteQuery();

         }
      }catch{
         write-host "Error: $($_.Exception.Message)"
      }
}

Disable-WorkflowAssociations -url $url -cred $cred

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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