public static Guid GetOneInstalledWorkflow(ref ClientContext clientContext, ref WorkflowServicesManager wfServiceManager) { WorkflowDeploymentService depService = wfServiceManager.GetWorkflowDeploymentService(); bool showPublishedWorkflows = true; WorkflowDefinitionCollection wfdefinitions = depService.EnumerateDefinitions(showPublishedWorkflows); clientContext.Load(wfdefinitions); clientContext.ExecuteQuery(); Console.WriteLine(wfdefinitions.First().DisplayName); return(wfdefinitions.First().Id); }
/// <summary> /// Get one installed workflow definition. /// </summary> public static Guid GetOneInstalledWorkflow(ref ClientContext clientConext, ref WorkflowServicesManager wfServicesManager) { // connect to deployment service WorkflowDeploymentService depService = wfServicesManager.GetWorkflowDeploymentService(); // get all installed workflows bool showOnlyPublishedWorkflows = true; WorkflowDefinitionCollection wfDefintions = depService.EnumerateDefinitions(showOnlyPublishedWorkflows); clientConext.Load(wfDefintions); clientConext.ExecuteQuery(); return(wfDefintions.First().Id); }
public static void ShowAllInstalledWorkflows(ref ClientContext clientContext, ref WorkflowServicesManager wfsm) { //connect to deployment service WorkflowDeploymentService depService = wfsm.GetWorkflowDeploymentService(); // get all installed workflows bool showOnlyPublishWorkflows = true; WorkflowDefinitionCollection definitions = depService.EnumerateDefinitions(showOnlyPublishWorkflows); clientContext.Load(definitions); clientContext.ExecuteQuery(); foreach (var def in definitions) { Console.WriteLine("Workflow ID: {0} - Workflow Name: {1}", def.Id, def.DisplayName); } }
/// <summary> /// Write out all installed workflows. /// </summary> public static void ShowAllInstalledWorkflows(ref ClientContext clientConext, ref WorkflowServicesManager wfServicesManager) { // connect to deployment service WorkflowDeploymentService depService = wfServicesManager.GetWorkflowDeploymentService(); // get all installed workflows bool showOnlyPublishedWorkflows = true; WorkflowDefinitionCollection wfDefintions = depService.EnumerateDefinitions(showOnlyPublishedWorkflows); clientConext.Load(wfDefintions); clientConext.ExecuteQuery(); // write all Console.WriteLine(); Console.WriteLine("All Installed Workflows:"); foreach (WorkflowDefinition wfDefintion in wfDefintions) { Console.WriteLine("{0} - {1}", wfDefintion.Id, wfDefintion.DisplayName); } }
public void UpdateWorkflowDefinitionXAML(PSHWorkflowDefinition WFDefinition) { using (var clientContext = new ClientContext(_PWAUrl)) { var workflowServicesManager = new WorkflowServicesManager(clientContext, clientContext.Web); // connect to the deployment service var workflowDeploymentService = workflowServicesManager.GetWorkflowDeploymentService(); //Get all the definitions from the Deployment Service, or get a specific definition using the GetDefinition method. WorkflowDefinitionCollection wfDefinitions = workflowDeploymentService.EnumerateDefinitions(false); clientContext.Load(wfDefinitions, wfDefs => wfDefs.Where(wfd => wfd.Id == WFDefinition.WFDefinitionId)); clientContext.ExecuteQuery(); WorkflowDefinition wfDefinition = wfDefinitions.First(); wfDefinition.DisplayName = WFDefinition.WFName; wfDefinition.Xaml = WFDefinition.WFDefinitionXAML; ClientResult <Guid> wfDefId = workflowDeploymentService.SaveDefinition(wfDefinition); workflowDeploymentService.PublishDefinition(wfDefinition.Id); clientContext.ExecuteQuery(); } }
public PSHWorkflowDefinition GetWorkflowDefinition(string WFDefinitionName) { PSHWorkflowDefinition objWFDefinition = null; using (var clientContext = new ClientContext(_PWAUrl)) { var workflowServicesManager = new WorkflowServicesManager(clientContext, clientContext.Web); // connect to the deployment service var workflowDeploymentService = workflowServicesManager.GetWorkflowDeploymentService(); Web oWeb = clientContext.Web; //Get all the definitions from the Deployment Service, or get a specific definition using the GetDefinition method. WorkflowDefinitionCollection wfDefinitions = workflowDeploymentService.EnumerateDefinitions(false); clientContext.Load(wfDefinitions, wfDefs => wfDefs.Where(wfd => wfd.DisplayName == WFDefinitionName)); clientContext.ExecuteQuery(); WorkflowDefinition wfDefinition = wfDefinitions.First(); ClientResult <Guid> wfDefId = workflowDeploymentService.SaveDefinition(wfDefinition); workflowDeploymentService.PublishDefinition(wfDefinition.Id); clientContext.ExecuteQuery(); if (wfDefinition != null) { objWFDefinition = new PSHWorkflowDefinition() { WFDefinitionId = wfDefinition.Id, WFDefinitionXAML = wfDefinition.Xaml, WFName = wfDefinition.DisplayName }; } } return(objWFDefinition); }
public Workflows() { this._workflowDefinitions = new Model.WorkflowDefinitionCollection(this.ParentTemplate); this._workflowSubscriptions = new Model.WorkflowSubscriptionCollection(this.ParentTemplate); }