6

How can I list all workflows and associations? I can find the number through the workflows page in the site collection administration, but i need to find the associations of each...

This is for MOSS 2007!

2
  • do u need to get the associations of only lists or content types too?
    – Deepu Nair
    Mar 14, 2012 at 8:39
  • just the workflows and what their list/library associations are in moss2007.
    – Mike
    Mar 14, 2012 at 16:22

3 Answers 3

3

You may use Powershell script to get all the workflow associations for all lists of the site.

Sample code might look like this -

UPDATED CODE for checking a particular list-

$siteCollectionUrl = "Your Site Collection URL"
$site = new-object Microsoft.SharePoint.SPSite($siteCollectionUrl)    
foreach ($web in $site.AllWebs)
{
 $listToCheck = "List Name"
 foreach ($list in $web.Lists) 
 { 
  if($list.Title -eq $listToCheck)
  {
   write-host "List Title -->" $list.Title
   foreach ($wf in $list.WorkFlowAssociations) 
    {      
     write-host "Workflow -->" $wf.Name
    }
  }
 }
}
$web.Dispose()
$site.Dispose()
11
  • this is for 2010, which I use powershell a bunch! But I need a solution for 2007.
    – Mike
    Mar 14, 2012 at 16:23
  • 1
    For all sites replace $web = $site.OpenWeb() with "foreach ($web in $site.AllWebs){" and add a "}" at the end Mar 15, 2012 at 16:52
  • 1
    Thanks for pointing out. Updated code with disposing objects for you. :)
    – Deepu Nair
    Mar 15, 2012 at 17:27
  • 1
    check this post Mike. Its exactly what you've asked- stackoverflow.com/questions/1999858/…
    – Deepu Nair
    Mar 15, 2012 at 17:40
  • 2
    The $web.Dispose() should be moved up one line so it's inside the loop Mar 15, 2012 at 17:58
2

SPWeb.WorkflowTemplates; gives you a list of all workflow in a site.

SPWorkflowManager.CountWorkflowAssociations gives you the count of all associations in a Site Collection

But to get all the associations you have to loop through all Content Types, Lists and Content Types in lists and look at the WorkflowAssociations property

If you want to use Deepu's PowerShell on 2007 the replace line 1 with

[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint")
$site = [Microsoft.Sharepoint.SPSite]("http://sharepoint")
$web = $site.OpenWeb()

But remeber that his script will not show workflows associated with ContentTypes or ContentTypes in lists

3
  • Ok, that's half the work, but I was hoping to take out the programming aspect. I wish there was powershell for 2007 that I can use a script like Deepu Nair posted...
    – Mike
    Mar 15, 2012 at 14:40
  • 1
    PowerShell tip added Mar 15, 2012 at 15:02
  • the powershell works, what a charm to have powershell on my 2007 box!! Thank you so much! However, look below it's not giving me what I need.
    – Mike
    Mar 15, 2012 at 16:07
1

Check out the Workflow Manager web part on http://sp2010adminpack.codeplex.com/. Should work on 2007.

1
  • Is there any way, i can get the same functionality in JSOM, only javascript/ecma script
    – samolpp2
    Mar 1, 2018 at 11:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.