How to List Out Workflows Designed by SharePoint Designer in a SharePoint 2007 Site (en-US)

How to List Out Workflows Designed by SharePoint Designer in a SharePoint 2007 Site (en-US)

Recently I have received many requests from many site administrators that they want to track the sharepoint designer workflows created in their sites. Hence I have developed this application. This works in Sharepoint 2007. This takes an input of site url and then it enumerates each and every list and find out the workflows associated with that list. Then it checks for their base template. The base template for a SPD workflow is null since these workflows are not created with any base template. In this way I have listed out the lists and the workflows designed by SPD associated with them.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.SharePoint;
using Microsoft.SharePoint.Workflow;
 
namespace RahulListOutSPDWorkflows
{
    class Program
    {
        static void Main(string[] args)
        {
            try
            {
                Console.WriteLine("This tool will provide you the list of SPD workflows and asociated lists in a site");
                Console.WriteLine("Please enter the url of the site");
                String webUrl = Console.ReadLine();
                using (SPSite site = new SPSite(webUrl))
                {
                    using (SPWeb web = site.OpenWeb())
                    {
                        SPListCollection lists = web.Lists;
                        foreach (SPList list in lists)
                        {
                          SPWorkflowAssociationCollection wAssociations = list.WorkflowAssociations;
                          foreach (SPWorkflowAssociation wAssociation in wAssociations)
                          {
                              if (wAssociation.BaseTemplate == null)
                              {
                                  Console.WriteLine("The List " + list.Title + " has SPD workflow " + wAssociation.Name);
                              }
                          }
                        }
                    }
                }
                Console.WriteLine("Execution Completed");
                Console.ReadLine();
            }
            catch (Exception e)
            {
                Console.WriteLine(e.StackTrace);
                Console.ReadLine();
            }
             
        }
    }
}


I hope this will help you out.

Thanks,
Rahul Rashu
Leave a Comment
  • Please add 8 and 4 and type the answer here:
  • Post
Wiki - Revision Comment List(Revision Comment)
Sort by: Published Date | Most Recent | Most Useful
Comments
  • Craig Lussier edited Revision 1. Comment: added en-US to tags and title

  • Ed Price - MSFT edited Original. Comment: Title casing and tags

Page 1 of 1 (2 items)
Wikis - Comment List
Sort by: Published Date | Most Recent | Most Useful
Posting comments is temporarily disabled until 10:00am PST on Saturday, December 14th. Thank you for your patience.
Comments
  • Ed Price - MSFT edited Original. Comment: Title casing and tags

  • Craig Lussier edited Revision 1. Comment: added en-US to tags and title

Page 1 of 1 (2 items)