Hi,
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
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
No comments:
Post a Comment