Sharepoint workflow 如何从powershell启动workflow 2013

Sharepoint workflow 如何从powershell启动workflow 2013,sharepoint-workflow,Sharepoint Workflow,上面有一些指南。有人能告诉我如何处理2013年的工作流程吗?它们不再列在$list.WorkFlowAssociations中 $siteURL = "URL" $web = Get-SPWeb $siteURL $wfm = New-object Microsoft.SharePoint.WorkflowServices.WorkflowServicesManager($web) $sub = $wfm.GetWorkflowSubscriptionService() $subscriptio

上面有一些指南。有人能告诉我如何处理2013年的工作流程吗?它们不再列在
$list.WorkFlowAssociations

$siteURL = "URL"
$web = Get-SPWeb $siteURL
$wfm = New-object Microsoft.SharePoint.WorkflowServices.WorkflowServicesManager($web)
$sub = $wfm.GetWorkflowSubscriptionService()
$subscriptions = $sub.EnumerateSubscriptionsByList($list.ID)
在$subscriptions中,有关联的工作流。希望有帮助

这显示了大部分答案,但他们试图遍历列表而不是列表中的项目。以下是更新版本

$sourceWebURL = '<URL>'
$sourceListName = '<List Name>'
$TargetWorkflow = '<Workflow Name>'
$spSourceWeb = Get-SPWeb $sourceWebURL
$spSourceList = $spSourceWeb.Lists[$sourceListName]
$items = $spSourceList.getItems()

#-- Getting a Workflow manager object to work with.
$wfm = New-object Microsoft.SharePoint.WorkflowServices.WorkflowServicesManager($spSourceweb)
#-- Getting the subscriptions
$sub = $wfm.GetWorkflowSubscriptionService()
#-- Getting the specific workflow within the list of subscriptions on the specific list. (SP2010 associated workflows basically)
$WF = $sub.EnumerateSubscriptionsByList($spSourcelist.ID) | Where-Object {$_.Name -eq "$TargetWorkflow"}
#-- Getting a Workflow instance in order to perform my commands.
$wfis=$wfm.GetWorkflowInstanceService()

Foreach($item in $items){
    #-- Creating the dictionary object I need to parse into StartWorkflow. This could be most other workflow commands.
    $object = New-Object 'system.collections.generic.dictionary[string,object]'
    $object.Add("WorkflowStart", "StartWorkflow");
    $wfis.StartWorkflowOnListItem($WF, $item.ID, $object)
}
$sourceWebURL=''
$sourceListName=“”
$TargetWorkflow=''
$spSourceWeb=获取SPWeb$sourceWebURL
$spSourceList=$spSourceWeb.Lists[$sourceListName]
$items=$spSourceList.getItems()
#--正在获取要使用的工作流管理器对象。
$wfm=新对象Microsoft.SharePoint.WorkflowServices.WorkflowServicesManager($spSourceweb)
#--获取订阅
$sub=$wfm.GetWorkflowSubscriptionService()
#--在特定列表上的订阅列表中获取特定工作流。(SP2010相关工作流程)
$WF=$sub.EnumerateSubscriptionsByList($spSourcelist.ID)|其中的对象{$\uz.Name-eq“$TargetWorkflow”}
#--获取工作流实例以执行我的命令。
$wfis=$wfm.GetWorkflowInstanceService()
Foreach($项目中的项目){
#--创建需要解析为StartWorkflow的dictionary对象。这可能是大多数其他工作流命令。
$object=新对象“system.collections.generic.dictionary[string,object]”
$object.Add(“WorkflowStart”、“StartWorkflow”);
$wfis.StartWorkflowOnListItem($WF、$item.ID、$object)
}
有关详细信息,请参阅