I'm working on SharePoint Online site, and i need to desactivate a workflow when updating some values with PowerShell.
Do you know if it's possible to modify EventTypes of an existing workflow dynamically with PowerShell?
I tried with this sample of code but no changes
# Connect
Connect-SPOnline -Url $webURL -Credentials $cred
$web = Get-SPOWeb
$list = Get-SPOList -Identity /Lists/List001
# Get subscription
$WFSub = Get-SPOWorkflowSubscription -Name "Workflow001"
# Set events
$WFSub.EventTypes.Remove("ItemAdded") | Out-Null
$web.Context.Load($WFSub)
$web.Context.ExecuteQuery()
I tried to apply changes with this sample of code, not working too :(
# Publish changes
$servicesManager = New-Object Microsoft.SharePoint.Client.WorkflowServices.WorkflowServicesManager($list.Context, $list.ParentWeb)
$subscriptionService = $servicesManager.GetWorkflowSubscriptionService()
$subscriptionResult = $subscriptionService.PublishSubscriptionForList($WFSub, $list.Id);
subscriptionResult returns:
Value
-----
00000000-0000-0000-0000-000000000000
I don't understand what is happen but no changes got effect on the workflow. I don't have any idea how to resolve this issue.
This script must modify those options:

Any help will be appreciated. Hope someone could help me.