English 中文(简体)
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 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?

最佳回答

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

问题回答

暂无回答




相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

NSArray s, Primitive types and Boxing Oh My!

I m pretty new to the Objective-C world and I have a long history with .net/C# so naturally I m inclined to use my C# wits. Now here s the question: I feel really inclined to create some type of ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

How to Use Ghostscript DLL to convert PDF to PDF/A

How to user GhostScript DLL to convert PDF to PDF/A. I know I kind of have to call the exported function of gsdll32.dll whose name is gsapi_init_with_args, but how do i pass the right arguments? BTW, ...

Linqy no matchy

Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...

热门标签