【问题标题】:Invoke Workflow through Custom Sequential Workflow in SharePoint通过 SharePoint 中的自定义顺序工作流调用工作流
【发布时间】:2009-12-02 21:36:50
【问题描述】:

我创建了一个 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。我该如何进行这项工作,或者有没有更好的方法在自定义工作流中调用另一个工作流?

【问题讨论】:

    标签: c# sharepoint workflow workflow-foundation


    【解决方案1】:

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

    【讨论】:

    • 我会接受这个答案,虽然我不能真正使用它,因为我的项目已经提交 =) 另外,在我来到 SO 之前,我做了很多自己的搜索;这是除了使用我们最终使用的黑客之外的最后手段(实际上更多的是妥协)。此外,调用两个工作流的问题是您必须在同一个线程中或其他东西中。由于某种原因,您无法从自定义工作流访问确切的 SP 上下文,因为它不在同一个执行线程中运行。我不知道您的回答是否有效,但希望它可以帮助其他人。
    • 嘿,贾里尔。对不起,我帮不上忙。虽然我喜欢接受的答案,但更好的做法是添加并接受您自己的答案 - 它确实解决了您的问题,并且更有可能帮助某人:)
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-10-07
    • 1970-01-01
    • 1970-01-01
    • 2011-04-30
    • 1970-01-01
    相关资源
    最近更新 更多