public bool StartWorkFlow() { private ClientContext _sharepoint = null; private Web _web = null; _sharepoint = new ClientContext("http://sharepoint/sites/dmdev/"); _sharepoint.AuthenticationMode = ClientAuthenticationMode.Default; string workflowName = "UpdateDealStatus"; // connect to the workflow services via a CSOM client context var workflowServicesManager = new WorkflowServicesManager(_sharepoint, _sharepoint.Web); // connect to the deployment service var workflowDeploymentService = workflowServicesManager.GetWorkflowDeploymentService(); // get all installed workflows var publishedWorkflowDefinitions = workflowDeploymentService.EnumerateDefinitions(true); _sharepoint.Load(publishedWorkflowDefinitions); try { _sharepoint.ExecuteQuery();//Error thrown from this line } catch (Exception ex) { } // find the first workflow definition var firstWorkflowDefinition = publishedWorkflowDefinitions.First(); // connect to the subscription service var workflowSubscriptionService = workflowServicesManager.GetWorkflowSubscriptionService(); // get all workflow associations var workflowAssociations = workflowSubscriptionService.EnumerateSubscriptionsByDefinition(firstWorkflowDefinition.Id); _sharepoint.Load(workflowAssociations); _sharepoint.ExecuteQuery(); foreach (var association in workflowAssociations) { Console.WriteLine("{0} - {1}", association.Id, association.Name); } return true; }
GetWorkflowDeploymentService
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)