从正在运行的工作流中启动工作流的正确方法是什么?
我们当前使用的是Visual Studio 2010,正在运行的工作流是Sharepoint 2010。以前,此工作流在Sharepoint 2007中正常工作,没有任何问题。将包迁移到2010后,状态工作流可以正常运行,但不能正确启动顺序工作流。如果手动启动序列,它将正常运行。
下面是我们用来从状态中调用序列的代码。
// Starts CAB Implementation Workflow.
SPWorkflowManager wfManager = this.workflowProperties.Site.WorkflowManager;
SPWorkflowAssociationCollection associationCol = this.workflowProperties.List.WorkflowAssociations;
foreach (SPWorkflowAssociation association in associationCol)
{
// Replace {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx} with the Id of the workflow you want to invoke
if (association.BaseId.ToString("B").Equals("{af0775b9-8f10-468d-9201-792a4f539c03}"))
{
wfManager.StartWorkflow(this.workflowProperties.Item, association, "", true);
break;
}
}发布于 2010-07-08 20:39:00
在创建这个问题时,我们找到了解决方案。看起来MOSS 2007并不介意关联数据为空。MOSS 2010不喜欢空数据,会启动工作流程,但很快就会失败。解决方案是给出一个空的xml标记作为关联数据。
// Starts CAB Implementation Workflow.
SPWorkflowManager wfManager = this.workflowProperties.Site.WorkflowManager;
SPWorkflowAssociationCollection associationCol = this.workflowProperties.List.WorkflowAssociations;
foreach (SPWorkflowAssociation association in associationCol)
{
// Replace {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx} with the Id of the workflow you want to invoke
if (association.BaseId.ToString("B").Equals("{af0775b9-8f10-468d-9201-792a4f539c03}"))
{
wfManager.StartWorkflow(this.workflowProperties.Item, association, "<root />", true);
break;
}
}现在,顺序工作流从该状态成功启动,没有任何问题。
https://stackoverflow.com/questions/3203592
复制相似问题