Hello All,
I am trying to get workflow association id from sharepoint list ,but it is showing me null value exception . I tried with below code .
public static void getWFByName(SPListItem listItem, SPSite spSite, string wfName) { SPList parentList = listItem.ParentList; SPWorkflowAssociationCollection associationCollection = parentList.WorkflowAssociations; foreach (SPWorkflowAssociation association in associationCollection) { if (association.Name == wfName) { Console.Write(association.Id); } } }
I have created workflow using SharePoint designer 2013 and I am working on SP 2013 server. I don't want to start worklfow through the code .. my overall aim is to get workflow XOML file on running workflow .. or is there any way to get the all the stage and variable which I am using into sharepoint desinger wf ?