A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
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