通过SharePoint中的自定义顺序工作流调用工作流

时间:2009-11-12 01:08:45

标签: c# sharepoint workflow workflow-foundation

我创建了一个SharePoint 2007 Sequential Workflow,并尝试以编程方式激活两个工作流程(一个批准和一个反馈)。

workflowProperties.Site.WorkflowManager.StartWorkflow(workflowProperties.Item, association, association.AssociationData, true);

我使用此代码启动工作流程,并且即时创建关联。当我尝试访问其他列表以创建关联对象时,会出现问题。

SPList approvalsList = workflowProperties.Web.Lists["Tasks"];
SPList historyList = workflowProperties.Web.Lists["Workflow History"];

这就是我得到的:

Unable to cast COM object of type 'Microsoft.SharePoint.Library.SPRequestInternalClass' to interface type 'Microsoft.SharePoint.Library.ISPRequest'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{BDEADEBE-C265-11D0-BCED-00A0C90AB50F}' failed due to the following error: Bad variable type. (Exception from HRESULT: 0x80020008 (DISP_E_BADVARTYPE)).

唯一可访问的列表是workflowProperties.List。如何使这项工作,或者有更好的方法在自定义工作流程中调用另一个工作流程?

1 个答案:

答案 0 :(得分:0)

我使用Useful Sharepoint Designer Custom Workflow Activities启动另一个工作流程 如果您不能按原样使用它,请查看其源代码。它看起来不像是手动设置任务和历史记录列表: http://spdactivities.codeplex.com/SourceControl/changeset/view/22637#201408