Table of Contents

Get Workflows

Once you got the organization, you can continue accessing the workflows. The following examples show how to get and work with workflows.

Get all Workflows

C#

using System;
using DocuWare.Platform.ServerClient;

namespace DocuWare.PlatformClientExamples
{
    static partial class Examples
    {
        public static Workflows GetWorkflows(Organization org)
        {
            var myWorkflows = org.GetWorkflowsFromWorkflowsRelation();
            foreach (var workflow in myWorkflows.Workflow)
                Console.WriteLine("You have accessed to the workflow " + workflow.Name + ".");

            return myWorkflows;
        }

        public static Workflows GetControllerWorkflows(Organization org)
        {
            var controllerWorkflows = org.GetWorkflowsFromControllerWorkflowsRelation();
            foreach (var workflow in controllerWorkflows.Workflow)
                Console.WriteLine("You have accessed to the workflow " + workflow.Name + " as a Controller.");

            return controllerWorkflows;
        }


    }
}

Get all Workflows asynchronously

C#

using System;
using DocuWare.Platform.ServerClient;
using System.Threading.Tasks;

namespace DocuWare.PlatformClientExamples
{
    static partial class ExamplesAsync
    {
        public static async Task<Workflows> GetWorkflowsAsync(Organization org)
        {
            var activeWorkflows =  await org.GetWorkflowsFromWorkflowsRelationAsync().ConfigureAwait(false);
            foreach (var workflow in activeWorkflows.Content.Workflow)
                Console.WriteLine("You have accessed to the workflow " + workflow.Name + ".");

            return activeWorkflows;
        }

        public static async Task<Workflows> GetControllerWorkflowsAsync(Organization org)
        {
            var controllerWorkflows =  await org.GetWorkflowsFromControllerWorkflowsRelationAsync().ConfigureAwait(false);
            foreach (var workflow in controllerWorkflows.Content.Workflow)
                Console.WriteLine("You have accessed to the workflow " + workflow.Name + " as a Controller.");

            return controllerWorkflows;
        }

    }
}