1

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: Workflow start options

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

1 Answer 1

0

try PowerShell pnp, it should be helpful. https://github.com/OfficeDev/PnP-PowerShell/blob/master/Documentation/RemoveSPOEventReceiver.md

6
  • Can you please be more specific regarding how this relates to the question above, and how it should be implemented? May 4, 2016 at 6:23
  • u don't even read did u?
    – Shawn
    May 4, 2016 at 6:24
  • Did I not? You post a link to documentation for how to remove an event receiver with PnP PowerShell. The question is regarding to updating an existing workflow definition. To me, there is a gap May 4, 2016 at 6:38
  • yes, the answer is not 100%, then I get a minus, hopeless place
    – Shawn
    May 4, 2016 at 6:39
  • You get voted down when you post answers not at all related to a question. This community works like this: Someone asks a question, users answer the question with qualitative and relevant responses. Yours are neither right now May 4, 2016 at 6:41

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.