Thursday, July 4, 2013

SharePoint programmatically get custom workflows in sharepoint

Here i comes to a requirement as part of some migrations.

I need to get all the list of worflows in site collections and need to differentiate the list of SPD workflows and OOTB workflows.

 

foreach (SPWorkflowAssociation workflowAssociation in workflowCollection)
    {
        string WorkflowType = string.Empty;
        if (workflowAssociation.BaseTemplate == null && workflowAssociation.InternalName.Contains("Xoml"))
        {
        WorkflowType = "SPD";
        }
        else
        {
        WorkflowType = "OOTB";
        }
Console.WriteLine(workflowAssociation.ParentSite.Url + "$" + workflowAssociation.ParentList.DefaultViewUrl + "$" + workflowAssociation.Name + "$" + workflowAssociation.RunningInstances + "$" + WorkflowType);
    }      


Reference for this post has taken from one of my friends blog

Thank you !!



No comments:

Post a Comment