有一些关于如何使用 powershell 处理 2010 工作流的指南。有人可以向我指出如何对 2013 工作流程做同样的事情吗?它们不再列在里面$list.WorkFlowAssociations
。
问问题
6781 次
2 回答
4
$siteURL = "URL"
$web = Get-SPWeb $siteURL
$wfm = New-object Microsoft.SharePoint.WorkflowServices.WorkflowServicesManager($web)
$sub = $wfm.GetWorkflowSubscriptionService()
$subscriptions = $sub.EnumerateSubscriptionsByList($list.ID)
在 $subscriptions 中,有相关的工作流。希望能帮助到你
于 2013-09-30T20:46:10.130 回答
4
此MSDN 博客文章显示了大部分答案,但他们试图迭代列表而不是列表中的项目。下面是一个更新的版本。
$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)
}
于 2014-10-22T18:46:11.363 回答