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

发布于 2024-08-11 02:50:31 字数 964 浏览 8 评论 0原文

我创建了一个 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

绝情姑娘 2024-08-18 02:50:31

我使用有用的 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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文