0

I need to write CSOM Code to retrieve SharePoint 2010/2013 workflows. I am able to get 2013 workflows only. Below is the code:

WorkflowAssociationCollection workflowcollection = list.WorkflowAssociations;

Context.Load(workflowcollection);

context.ExecuteQuery();

foreach(WorkflowAssociation WFassociation in workflowcollection)

{

  workflowName = workflowName+ WFassociation.Name.ToString()+";";

}

This code only returns 2013 workflows. How do I retrieve 2010 workflows?

0

Try using WorkflowAssociations.GetAssociationByBaseID as below

[list].WorkflowAssociations.GetAssociationByBaseID([workflow base ID]);

The above returns a SPWorkflowAssociation object, which can be used as a parameter to start the workflow. e.g. below:

[site].WorkflowManager.StartWorkflow([list item],[SPWorkflowAssociation], "<root />");

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.