2

In SharePoint 2013 on-prem I provision custom workflows (.xaml - definitions) to SharePoint sites by using office dev-PnP. I add the workflow to a spesific list in all sites, and the workflow works perfectly fine from the GUI. Since I am using office dev PnP the workflows are not pushed out by features.

I am using powershell script and need to start some of the workflows that are on the lists via the script, but I can not get/find the workflow on spweb or splist objects.

I have tried this code to check the count of workflow associations, and in each case it gives the count of 0:

$url = "http://<site>/<subsite<>"
$web = Get-SPWeb $url
$listName = "<listName>"
$list = $web.Lists.TryGetList($listName)

if($list -ne $null)
{
Write-Host "List workflow association count " + $list.WorkflowAssociations.Count
Write-Host "Web workflow association count " + $web.WorkflowAssociations.Count
Write-Host "Site workflow association count" +$web.Site.RootWeb.WorkflowAssociations.Count
}

I know the ID and the name of the workflows, but I can not find them. Can I somehow find them, and start the workflow using PowerShell ?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.