本文介绍了List.WorkflowAssociations为空的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问候!

我创建了我需要开始的WF 主要版本发布。 前段时间我和我通过简单的 成功地将WF绑定在此事件上PS-脚本 喜欢:

I've created WF which i need to start on  major version publishing.  Some time ago i  succeeded to bind WF on this event by simple  PS-script  like:

$web = get-spweb -identity "*Site URL*"
$mylib = $web.Lists["*Library Name*"]
$wa_guid = ($mylib.WorkflowAssociations | where {$_.Name -like *Workflow unique name*}).Id
$mylib.DefaultContentApprovalWorkflowId = $wa_guid
$mylib.Update()

这是有效的 那些日子,但现在没有。现在我成功发布了  WF,我可以启动它并完成它,但是$ mylib.WorkflowAssociations属性仍然是空的。 属性是只读的,我无法手动添加对象。 
 我已尝试添加订阅 到 通过        Microsoft.SharePoint.WorkflowServices.WorkflowServicesManager实例对样本创建了WF,它没问题,但是 此关联也未保存在&WorkflowAssociations属性中。 

And this worked  those days, but no now. Now i successfully can publish the  WF, i can start it and complete it, but the $mylib.WorkflowAssociations property is still empty.  Property is read-only and i cannot add an object there manually.   I've tried to add subscription  to  sample PS-created WF by  Microsoft.SharePoint.WorkflowServices.WorkflowServicesManager instance and it was ok, but  this association also has not saved in WorkflowAssociations property. 

我已经尝试了另一个WF和另一个 列表 - 情况是一样的。我已经尝试过WF2010 -    工作流协会属性在这种情况下得到了它的内容。 我查了一下 另一个创建前一段时间的列表和WF的 - WorkflowAssociations 
不为空。

I've tried another WF and another  list - the situation is the same. I've tried WF2010 -  WorkflowAssociations property got it's content in this case.  I've checked  another created some time ago lists and WF's - WorkflowAssociations  is not empty.

我不知道可能出现什么问题并询问任何建议或想法。

I have no idea what could be wrong and asking for any advice or idea.

推荐答案

List.WorkflowAssociations将不包括SharePoint 2013平台工作流,只返回SharePoint 2010平台工作流。

List.WorkflowAssociations won't include SharePoint 2013 platform workflows only return SharePoint 2010 platform workflows.

获取SharePoint 2013工作流的正确方法是使用WorkflowServicesManager,如下面的脚本:

The right way to get the SharePoint 2013 workflows is using WorkflowServicesManager like the script below:




这篇关于List.WorkflowAssociations为空的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-30 14:10