07
Mar
I wrote an eventhandler which needs to update a publishingpage to the next minor version and (re)start a workflow from code.
Cleaning up any running workflows of the same type will prevent 'Exception from HRESULT: 0x8102009B'.
foreach (SPWorkflowAssociation wfAssoc in item.ContentType.WorkflowAssociations) {// search workflowassociation by name if ((wfAssoc.Name.ToLower().Contains("controleren")) && (wfAssoc.Name.ToLower().Contains("publicatie"))) {// check current item for running workflows of the same type foreach(SPWorkflow wf in item.Workflows) { if (wf.ParentAssociation.Name.Equals(wfAssoc.Name)) {// remove running workflow item.Web.Site.WorkflowManager.RemoveWorkflowFromListItem(wf); } }// start workflow item.Web.Site.WorkflowManager.StartWorkflow(item, wfAssoc, wfAssoc.AssociationData); break; } }
Comments (0) | Permalink
Tam Tam brengt je wereld online.