通过 SharePoint 中的自定义顺序工作流调用工作流
我创建了一个 SharePoint 2007 顺序工作流,并尝试以编程方式激活两个工作流(一个批准和一个反馈)。
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。我该如何完成这项工作,或者是否有更好的方法来调用自定义工作流程中的另一个工作流程?
I've created a SharePoint 2007 Sequential Workflow and am trying to activate two workflows (one approval and one feedback) programmatically.
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. How do I make this work, or are there any better ways to invoke another workflow in a custom workflow?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我使用有用的 Sharepoint Designer 自定义工作流程活动来启动另一个工作流程。
如果您无法按原样使用它,请查看其源代码。他们看起来不像手动设置任务和历史列表:
http://spdactivities.codeplex.com/SourceControl/changeset/view/22637# 201408
I use Useful Sharepoint Designer Custom Workflow Activities to start another workflow.
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