in

SharePoint University

Clean slate. Nothing but SharePoint.
Go, SharePoint!

Exception on programmatic workflow execution

Last post 06-27-2007 7:30 AM by Mike Hodnick. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 06-26-2007 7:55 AM

    Exception on programmatic workflow execution

    I'm getting the following exception (pasted below) when attempting to programmatically execute a workflow using SPWorkflowManager.StartWorkFlow(). The list item is coming from a CAML query, and the workflow is obtained after enumerating through a list's workflow associations (SPList.WorkflowAssociations):

    wfmgr.StartWorkflow(item, workflow, workflow.AssociationData);

    Any ideas?

    Microsoft.SharePoint.SPException: Exception from HRESULT: 0x8102009B ---> System.Runtime.InteropServices.COMException (0x8102009B): Exception from HRESULT: 0x8102009B at Microsoft.SharePoint.Library.SPRequestInternalClass.AddWorkflowToListItem(String bstrUrl, String bstrListName, Int32 lItemID, Int32 lItemLevel, Int32 lItemVersion, Guid workflowPackageId, Guid& pWorkflowInstanceId, Guid workflowTaskListId, String bstrStatusFieldInternalName, Int32 lAuthorId) at Microsoft.SharePoint.Library.SPRequest.AddWorkflowToListItem(String bstrUrl, String bstrListName, Int32 lItemID, Int32 lItemLevel, Int32 lItemVersion, Guid workflowPackageId, Guid& pWorkflowInstanceId, Guid workflowTaskListId, StringbstrStatusFieldInternalName, Int32 lAuthorId) --- End of inner exception stack trace --- at Microsoft.SharePoint.Library.SPRequest.AddWorkflowToListItem(String bstrUrl, String bstrListName, Int32 lItemID, Int32 lItemLevel, Int32 lItemVersion, Guid workflowPackageId, Guid& pWorkflowInstanceId, Guid workflowTaskListId, StringbstrStatusFieldInternalName, Int32 lAuthorId) at Microsoft.SharePoint.Workflow.SPWorkflowManager.StartWorkflowElev(SPListItem item, SPFile file, SPWorkflowAssociation association, SPWorkflowEvent startEvent, Boolean bAutoStart, Boolean bCreateOnly) at Microsoft.SharePoint.Workflow.SPWorkflowManager.<>c__DisplayClass1.b__0() at Microsoft.SharePoint.SPSecurity.CodeToRunElevatedWrapper(Object state) at Microsoft.SharePoint.SPSecurity.<>c__DisplayClass4.b__2() at Microsoft.SharePoint.Utilities.SecurityContext.RunAsProcess(CodeToRunElevated secureCode) at Microsoft.SharePoint.SPSecurity.RunWithElevatedPrivileges(WaitCallback secureCode, Object param) at Microsoft.SharePoint.SPSecurity.RunWithElevatedPrivileges(CodeToRunElevated secureCode) at Microsoft.SharePoint.Workflow.SPWorkflowManager.StartWorkflow(SPListItem item, SPWorkflowAssociation association, SPWorkflowEvent startEvent, Boolean bAutoStart, Boolean bCreateOnly) at Microsoft.SharePoint.Workflow.SPWorkflowManager.StartWorkflow(SPListItem item, SPWorkflowAssociation association, String eventData, Boolean isAutoStart) at Microsoft.SharePoint.Workflow.SPWorkflowManager.StartWorkflow(SPListItem item, SPWorkflowAssociation association, String eventData)
    -----------
    Mike Hodnick
    http://www.kindohm.com
    Lead Consultant
    Inetium
    http://www.inetium.com
    Filed under: , ,
  • 06-27-2007 7:30 AM In reply to

    Re: Exception on programmatic workflow execution

    It turns out that this exception is thrown if the list item already has a "terminated" workflow that is also flagged as "running".  e.g. an error occurred and you need to explicitly terminate the workflow for it to end.  I wrote up a summary here:

    http://www.kindohm.com/archive/2007/06/26/com-exception-on-programmatic-wss-workflow-execution.aspx

     

    -----------
    Mike Hodnick
    http://www.kindohm.com
    Lead Consultant
    Inetium
    http://www.inetium.com
Page 1 of 1 (2 items)

Need SharePoint Training? Attend a SharePoint Bootcamp!
Forum content (c) original posters. Everything else (c) 2008 SharePoint Experts, Inc.