简体   繁体   English

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

[英]Invoke Workflow through Custom Sequential Workflow in SharePoint

I've created a SharePoint 2007 Sequential Workflow and am trying to activate two workflows (one approval and one feedback) programmatically. 我已经创建了SharePoint 2007顺序工作流,并试图以编程方式激活两个工作流(一个批准和一个反馈)。

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

I use this code to start the work flow and the association is created on the fly. 我使用此代码启动工作流程,并快速创建了关联。 The problem arises when I am trying to access the other lists in order to create the association object. 当我尝试访问其他列表以创建关联对象时,就会出现问题。

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

This is what I get: 这是我得到的:

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)).

The only list that is accessible is through workflowProperties.List. 唯一可访问的列表是通过workflowProperties.List。 How do I make this work, or are there any better ways to invoke another workflow in a custom workflow? 我如何进行这项工作,或者在自定义工作流程中是否有更好的方法来调用另一个工作流程?

I use Useful Sharepoint Designer Custom Workflow Activities to start another workflow. 我使用有用的Sharepoint Designer自定义工作流程活动来启动另一个工作流程。
If you can't use it as-is, have a look at its source code. 如果您不能原样使用它,请查看其源代码。 It doesn't look like they manually set the task and history lists: http://spdactivities.codeplex.com/SourceControl/changeset/view/22637#201408 看起来他们没有手动设置任务和历史记录列表: http : //spdactivities.codeplex.com/SourceControl/changeset/view/22637#201408

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM