开发者

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.

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 on开发者_如何学Pythonly 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?


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜