首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >从状态工作流中启动顺序工作流

从状态工作流中启动顺序工作流
EN

Stack Overflow用户
提问于 2010-07-08 20:36:44
回答 1查看 881关注 0票数 0

从正在运行的工作流中启动工作流的正确方法是什么?

我们当前使用的是Visual Studio 2010,正在运行的工作流是Sharepoint 2010。以前,此工作流在Sharepoint 2007中正常工作,没有任何问题。将包迁移到2010后,状态工作流可以正常运行,但不能正确启动顺序工作流。如果手动启动序列,它将正常运行。

下面是我们用来从状态中调用序列的代码。

代码语言:javascript
复制
// 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;
            }
        }
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2010-07-08 20:39:00

在创建这个问题时,我们找到了解决方案。看起来MOSS 2007并不介意关联数据为空。MOSS 2010不喜欢空数据,会启动工作流程,但很快就会失败。解决方案是给出一个空的xml标记作为关联数据。

代码语言:javascript
复制
// 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;
            }
        }

现在,顺序工作流从该状态成功启动,没有任何问题。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/3203592

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档