0

実行中のワークフロー内からワークフローを起動する適切な方法は何ですか?

現在、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;
            }
        }
4

1 に答える 1

0

この質問を作成しているときに、解決策を見つけました。アソシエーション データが null であっても、MOSS 2007 は気にしなかったようです。MOSS 2010 は null データを好まず、ワークフローを開始しますが、すぐに失敗します。解決策は、関連付けデータとして空の 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;
            }
        }

これで、シーケンシャル ワークフローが問題なく状態から正常に起動します。

于 2010-07-08T12:38:59.513 に答える