Disable SPD2010 workflows on SPO site

Jiniv Thakkar 96 Reputation points
2020-12-23T11:39:11.897+00:00

Hi All,

I have around 100 SPD 2010 workflows in SharePoint online.

Can we disable SPD 2010 workflows in SharePoint online site using Powershell or PNP?

Please help.

Microsoft 365 and Office | SharePoint | For business | Windows

Answer accepted by question author
Jiniv Thakkar 96 Reputation points
2020-12-29T12:14:05.087+00:00

Hey Guys,

I was able to write a script to disable SPD2010 workflow. Please find details below, just update your sitename, login details and list ID

$url = "https://your.sharepoint.com/sites/abc"
$userName = "abc@xyz .onmicrosoft.com"
$password = ConvertTo-SecureString "India@000" -AsPlainText -Force

$SPOCredentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($userName, $password)

Function Disable-WorkflowAssociations($url,$SPOCredentials)
{
try{
$context = New-Object Microsoft.SharePoint.Client.ClientContext($url)
$context.Credentials = $SPOcredentials
$AllLists=$context.Web.Lists
$list=$AllLists.GetById("#Idhere") #GetBYTitle can also be used
$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 -SPOCredentials $SPOCredentials

Was this answer helpful?

0 comments No comments

3 additional answers

Sort by: Most helpful
  1. Jiniv Thakkar 96 Reputation points
    2020-12-29T12:31:18.183+00:00

    Thanks everyone for the help hope my script helps others and closing the question.

    Was this answer helpful?

    0 comments No comments

  2. Echo Du_MSFT 17,351 Reputation points
    2020-12-24T02:09:21.85+00:00

    Hello JinivThakkar-0173 ,

    SharePoint 2010 workflows have been retired since August 1, 2020 for new tenants and removed from existing tenants on November 1, 2020. This applies to all environments where Power Automate is available as a replacement solution (excluding the Department of Defense until Power Automate availability).

    After August 1, 2020, new Microsoft 365 customers can use SharePoint 2013 workflows or Power Automate. However, SharePoint 2013 workflows will follow a similar retirement path in the future, so it's highly recommended to use Power Automate or other supported solutions. You won't lose any content during the transition. However, all migration of workflows is a manual process.

    If you want to know how to disable workflow through powershell, you can refer to the following article:

    Thanks,

    Echo Du

    If an Answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    Was this answer helpful?

    0 comments No comments

  3. trevorseward 11,711 Reputation points
    2020-12-24T00:32:52.807+00:00

    Was this answer helpful?

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.