In this article we will be seeing how to get the workflows associated with a specific list using PowerShell in SharePoint 2010.
In this article
Get the workflows associated with a specific list using C#.
Get the workflows associated with a specific list using PowerShell.
Get the workflows associated with a specific list using C#
a. Open Visual Studio 2010.
b. Create Console Application.
c. Add the following Reference. i) Microsoft.SharePoint.dll d. Add the following Namespaces. i) using Microsoft.SharePoint;
ii) using Microsoft.SharePoint.Workflow;
e. Replace the code with the following.
class Program
{
static void Main(string[] args)
{
using (SPSite site = new SPSite("http://servername:1111/"))
{
using (SPWeb web = site.RootWeb)
{
SPList list = web.Lists["Users"];
SPWorkflowManager manager = site.WorkflowManager;
SPWorkflowAssociationCollection associationColl = list.WorkflowAssociations;
foreach (SPWorkflowAssociation association in associationColl)
{
Console.WriteLine(association.Name.ToString());
}
Console.ReadLine();
}
}
}
}
Get the workflows associated with a specific list using PowerShell
$siteURL="http://serverName:1111/"
$listName="Users"
$site=Get-SPSite $siteURL
$web=$site.RootWeb
$list=$web.Lists[$listName]
$wfManager=$site.WorkflowManager
$associationColl=$list.WorkflowAssociations
foreach($association in $associationColl)
{
write-host $association.Name
}
$web.Dispose()
$site.Dispose()
コメント