Cannot publish workflow to scope because it already contains the maximum number of workflows allowed

%3CLINGO-SUB%20id%3D%22lingo-sub-1059688%22%20slang%3D%22en-US%22%3ECannot%20publish%20workflow%20to%20scope%20because%20it%20already%20contains%20the%20maximum%20number%20of%20workflows%20allowed%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1059688%22%20slang%3D%22en-US%22%3E%3CP%3EI'm%20getting%20the%20attached%20error%20(IDs%20hidden)%20when%20I'm%20running%20Powershell%20CSOM%20to%20delete%20existing%20List%20workflows%20and%20create%20a%20new%20workflow%20from%20a%20template.%26nbsp%3B%20Googled%20the%20error%20but%20it%20no%20results%20returned%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ECan%20anyone%20help%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EError%3A%3C%2FP%3E%3CP%3EException%20calling%20%22ExecuteQuery%22%20with%20%220%22%20argument(s)%3A%20%22Microsoft.Workflow.Client.InvalidRequestException%3A%20Cannot%20publish%20workflow%20%3CID%3E%20to%20scope%3CBR%20%2F%3E%2Fspo%2F%3CID%3E%2F%3CID%3E%2F%3CID%3E%20because%20it%20already%20contains%20the%20maximum%20number%20of%20workflows%20allowed%20in%20a%20scope%20(1800).%20HTTP%20headers%20received%20from%20the%3CBR%20%2F%3Eserver%20-%20ActivityId%3A%20%3CID%3E.%20NodeId%3A%20WFFE_IN_0.%20Scope%3A%20%2Fspo%2F%3CID%3E%2F%3CID%3E%22%3C%2FID%3E%3C%2FID%3E%3C%2FID%3E%3C%2FID%3E%3C%2FID%3E%3C%2FID%3E%3C%2FID%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EScript%20details%20(%24Context%2C%20%24ListName%2C%20%24WorkflowName%20and%26nbsp%3B%24XamlPath%20are%20passed%20into%20the%20function)%3A%3C%2FP%3E%3CP%3E%24List%26nbsp%3B%3D%26nbsp%3B%24Context.Web.Lists.GetByTitle(%24ListName)%3C%2FP%3E%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%24Context.Load(%24List)%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%24web%26nbsp%3B%3D%26nbsp%3B%24Context.Web%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%24Context.Load(%24web)%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%24Context.ExecuteQuery()%3C%2FP%3E%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%24WorkflowServicesManager%26nbsp%3B%3D%26nbsp%3BNew-Object%26nbsp%3BMicrosoft.SharePoint.Client.WorkflowServices.WorkflowServicesManager(%24Context%2C%26nbsp%3B%24Context.Web)%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%24Context.Load(%24WorkflowServicesManager)%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%24Context.ExecuteQuery()%3C%2FP%3E%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%23%26nbsp%3BGet%26nbsp%3BWorkflowAssociations%26nbsp%3Bwith%26nbsp%3BList%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%24wfDeploymentService%26nbsp%3B%3D%26nbsp%3B%24WorkflowServicesManager.GetWorkflowDeploymentService()%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%24Context.Load(%24wfDeploymentService)%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%24Context.ExecuteQuery()%3C%2FP%3E%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%23%23%23%23%23%23%26nbsp%3BCLEANUP%26nbsp%3B%23%23%23%23%23%23%23%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%23%26nbsp%3BRemoves%26nbsp%3Bthe%26nbsp%3Bold%26nbsp%3Bworkflow%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3Btry%7B%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%24wfDefinitions%26nbsp%3B%3D%26nbsp%3B%24wfDeploymentService.EnumerateDefinitions(%24false)%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%24Context.Load(%24wfDefinitions)%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%24Context.ExecuteQuery()%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%24ExistingReportDefinitions%26nbsp%3B%3D%26nbsp%3B%24wfDefinitions%26nbsp%3B%7C%26nbsp%3Bwhere-object%26nbsp%3B%7B%24_.DisplayName%26nbsp%3B-like%26nbsp%3B%24WorkflowName%7D%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3Bif%26nbsp%3B(%24ExistingReportDefinitions)%26nbsp%3B%7B%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3Bforeach%26nbsp%3B(%24ExistingReport%26nbsp%3Bin%26nbsp%3B%24ExistingReportDefinitions)%26nbsp%3B%7B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%24wfDeploymentService.DeleteDefinition(%24ExistingReport.id)%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3BWrite-Host%26nbsp%3B%22Deleted%26nbsp%3Bworkflow%26nbsp%3B%24WorkflowName%22%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%7D%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%24Context.Load(%24wfDeploymentService)%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%24Context.ExecuteQuery()%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%7D%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%7Dcatch%7B%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3BWrite-Host%26nbsp%3B%22No%26nbsp%3Bpre-existing%26nbsp%3Bworkflow.%26nbsp%3B%26nbsp%3BContinuing%26nbsp%3Bwith%26nbsp%3Bworkflow%26nbsp%3Bcreation%22%26nbsp%3B-ForegroundColor%26nbsp%3BYellow%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%7D%3C%2FP%3E%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%24Xaml%26nbsp%3B%3D%26nbsp%3B%5BSystem.Xml.Linq.XElement%5D%3A%3ALoad(%24XamlPath)%3C%2FP%3E%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%23%26nbsp%3BPrepare%26nbsp%3Bthe%26nbsp%3BWorkflow%26nbsp%3BDefinition%26nbsp%3Bobject%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%24wfDefinition%26nbsp%3B%3D%26nbsp%3BNew-Object%26nbsp%3BMicrosoft.SharePoint.Client.WorkflowServices.WorkflowDefinition%26nbsp%3B-ArgumentList%26nbsp%3B%24Context%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%24wfDefinition.DisplayName%26nbsp%3B%3D%26nbsp%3B%24WorkflowName%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%24wfDefinition.Description%26nbsp%3B%3D%26nbsp%3B%22List%26nbsp%3BWorkflow%26nbsp%3B%24WorkflowName%26nbsp%3Bassociated%26nbsp%3Bwith%26nbsp%3B%24ListName%22%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%24wfDefinition.Xaml%26nbsp%3B%3D%26nbsp%3B%24Xaml.ToString()%3C%2FP%3E%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%23%26nbsp%3BSave%26nbsp%3Band%26nbsp%3Bpublish%26nbsp%3Bthe%26nbsp%3BWorkflow%26nbsp%3BDefinition%26nbsp%3Bobject%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%24definitionId%26nbsp%3B%3D%26nbsp%3B%24wfDeploymentService.SaveDefinition(%24wfDefinition)%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%24Context.Load(%24wfDefinition)%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%24Context.ExecuteQuery()%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%23%26nbsp%3BPublish%26nbsp%3Bthe%26nbsp%3BWorkflow%26nbsp%3BDefinition%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%24wfDeploymentService.PublishDefinition(%24definitionId.Value)%3C%2FP%3E%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%24historyList%26nbsp%3B%3D%26nbsp%3B%24Context.Web.Lists.GetByTitle(%22Workflow%26nbsp%3BHistory%22)%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%24Context.Load(%24historyList)%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%24tasksList%26nbsp%3B%3D%26nbsp%3B%24Context.Web.Lists.GetByTitle(%22Workflow%26nbsp%3BTasks%22)%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%24Context.Load(%24tasksList)%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%24Context.ExecuteQuery()%3C%2FP%3E%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%23%26nbsp%3BAssociate%26nbsp%3Bthe%26nbsp%3BWorkflow%26nbsp%3BDefinition%26nbsp%3Bto%26nbsp%3Ba%26nbsp%3Btarget%26nbsp%3Blist%2Flibrary%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%24WorkflowSubscriptionService%26nbsp%3B%3D%26nbsp%3B%24WorkflowServicesManager.GetWorkflowSubscriptionService()%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%24Context.Load(%24WorkflowSubscriptionService)%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%24Context.ExecuteQuery()%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%24wfSubscription%26nbsp%3B%3D%26nbsp%3BNew-Object%26nbsp%3BMicrosoft.SharePoint.Client.WorkflowServices.WorkflowSubscription%26nbsp%3B-ArgumentList%26nbsp%3B%24Context%3C%2FP%3E%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%23%26nbsp%3BConfigure%26nbsp%3Bthe%26nbsp%3BWorkflow%26nbsp%3BSubscription%26nbsp%3B%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%24wfSubscription.DefinitionId%26nbsp%3B%3D%26nbsp%3B%24definitionId.Value%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%24wfSubscription.Name%26nbsp%3B%3D%26nbsp%3B%24wfDefinition.DisplayName%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%24wfSubscription.Enabled%26nbsp%3B%3D%26nbsp%3B%24true%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%24eventTypes%26nbsp%3B%3D%26nbsp%3BNew-Object%26nbsp%3BSystem.Collections.Generic.List%5BString%5D%3C%2FP%3E%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%23%26nbsp%3BAvailable%26nbsp%3Bvalues%26nbsp%3Bare%3A%26nbsp%3BItemAdded%2C%26nbsp%3BItemUpdated%2C%26nbsp%3BWorkflowStart%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%24eventTypes.Add(%22WorkflowStart%22)%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%23%24eventTypes.Add(%22ItemAdded%22)%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%24eventTypes.Add(%22ItemUpdated%22)%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%24wfSubscription.EventTypes%26nbsp%3B%3D%26nbsp%3B%24eventTypes%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%24wfSubscription.EventSourceId%26nbsp%3B%3D%26nbsp%3B%24List.Id.guid.ToString()%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%24wfSubscription.SetProperty(%22TaskListId%22%2C%26nbsp%3B%24tasksList.Id.ToString())%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%24wfSubscription.SetProperty(%22HistoryListId%22%2C%26nbsp%3B%24historyList.Id.ToString())%3C%2FP%3E%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%23%26nbsp%3BPublish%26nbsp%3Bthe%26nbsp%3BWorkflow%26nbsp%3BSubscription%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%24WorkflowSubscriptionService.PublishSubscriptionForList(%24wfSubscription%2C%26nbsp%3B%24List.Id.guid.ToString())%26nbsp%3B%7C%26nbsp%3BOut-Null%3CBR%20%2F%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%24Context.ExecuteQuery()%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1059688%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EDeveloper%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
Occasional Contributor

I'm getting the attached error (IDs hidden) when I'm running Powershell CSOM to delete existing List workflows and create a new workflow from a template.  Googled the error but it no results returned

 

Can anyone help?

 

Error:

Exception calling "ExecuteQuery" with "0" argument(s): "Microsoft.Workflow.Client.InvalidRequestException: Cannot publish workflow <ID> to scope
/spo/<ID>/<ID>/<ID> because it already contains the maximum number of workflows allowed in a scope (1800). HTTP headers received from the
server - ActivityId: <ID>. NodeId: WFFE_IN_0. Scope: /spo/<ID>/<ID>"

 

Script details ($Context, $ListName, $WorkflowName and $XamlPath are passed into the function):

$List = $Context.Web.Lists.GetByTitle($ListName)

    $Context.Load($List)
    $web = $Context.Web
    $Context.Load($web)
    $Context.ExecuteQuery()

    $WorkflowServicesManager = New-Object Microsoft.SharePoint.Client.WorkflowServices.WorkflowServicesManager($Context, $Context.Web)
    $Context.Load($WorkflowServicesManager)
    $Context.ExecuteQuery()

    # Get WorkflowAssociations with List
    $wfDeploymentService = $WorkflowServicesManager.GetWorkflowDeploymentService()
    $Context.Load($wfDeploymentService)
    $Context.ExecuteQuery()

    ###### CLEANUP #######
    # Removes the old workflow
    try{
        $wfDefinitions = $wfDeploymentService.EnumerateDefinitions($false)
        $Context.Load($wfDefinitions)
        $Context.ExecuteQuery()
        $ExistingReportDefinitions = $wfDefinitions | where-object {$_.DisplayName -like $WorkflowName}
        if ($ExistingReportDefinitions) {
            foreach ($ExistingReport in $ExistingReportDefinitions) {                
                $wfDeploymentService.DeleteDefinition($ExistingReport.id)
                Write-Host "Deleted workflow $WorkflowName"
            }
            $Context.Load($wfDeploymentService)
            $Context.ExecuteQuery()
        }
    }catch{
        Write-Host "No pre-existing workflow.  Continuing with workflow creation" -ForegroundColor Yellow
    }

    $Xaml = [System.Xml.Linq.XElement]::Load($XamlPath)

    # Prepare the Workflow Definition object
    $wfDefinition = New-Object Microsoft.SharePoint.Client.WorkflowServices.WorkflowDefinition -ArgumentList $Context
    $wfDefinition.DisplayName = $WorkflowName
    $wfDefinition.Description = "List Workflow $WorkflowName associated with $ListName"
    $wfDefinition.Xaml = $Xaml.ToString()

    # Save and publish the Workflow Definition object
    $definitionId = $wfDeploymentService.SaveDefinition($wfDefinition)
    $Context.Load($wfDefinition)
    $Context.ExecuteQuery()
    
    # Publish the Workflow Definition
    $wfDeploymentService.PublishDefinition($definitionId.Value)

    $historyList = $Context.Web.Lists.GetByTitle("Workflow History")
    $Context.Load($historyList)
    $tasksList = $Context.Web.Lists.GetByTitle("Workflow Tasks")
    $Context.Load($tasksList)
    $Context.ExecuteQuery()

    # Associate the Workflow Definition to a target list/library
    $WorkflowSubscriptionService = $WorkflowServicesManager.GetWorkflowSubscriptionService()
    $Context.Load($WorkflowSubscriptionService)
    $Context.ExecuteQuery()
    $wfSubscription = New-Object Microsoft.SharePoint.Client.WorkflowServices.WorkflowSubscription -ArgumentList $Context

    # Configure the Workflow Subscription 
    $wfSubscription.DefinitionId = $definitionId.Value
    $wfSubscription.Name = $wfDefinition.DisplayName
    $wfSubscription.Enabled = $true
    $eventTypes = New-Object System.Collections.Generic.List[String]

    # Available values are: ItemAdded, ItemUpdated, WorkflowStart
    $eventTypes.Add("WorkflowStart")
    #$eventTypes.Add("ItemAdded")
    $eventTypes.Add("ItemUpdated")
    $wfSubscription.EventTypes = $eventTypes
    
    $wfSubscription.EventSourceId = $List.Id.guid.ToString()
    $wfSubscription.SetProperty("TaskListId", $tasksList.Id.ToString())
    $wfSubscription.SetProperty("HistoryListId", $historyList.Id.ToString())

    # Publish the Workflow Subscription
    $WorkflowSubscriptionService.PublishSubscriptionForList($wfSubscription, $List.Id.guid.ToString()) | Out-Null
    $Context.ExecuteQuery()

0 Replies