Invoke Workflow through Custom Sequential Workflow in SharePoint

0

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?

c#
sharepoint
workflow
workflow-foundation
asked on Stack Overflow Nov 12, 2009 by Jaryl • edited Dec 2, 2009 by AnthonyWJones

1 Answer

0

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

answered on Stack Overflow Dec 2, 2009 by Kobi

User contributions licensed under CC BY-SA 3.0