Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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!

share|improve this question
    
do u need to get the associations of only lists or content types too? –  Deepu Nair Mar 14 '12 at 8:39
    
just the workflows and what their list/library associations are in moss2007. –  Mike Mar 14 '12 at 16:22
add comment

3 Answers 3

up vote 2 down vote accepted

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()
share|improve this answer
    
this is for 2010, which I use powershell a bunch! But I need a solution for 2007. –  Mike Mar 14 '12 at 16:23
1  
For all sites replace $web = $site.OpenWeb() with "foreach ($web in $site.AllWebs){" and add a "}" at the end –  Per Jakobsen Mar 15 '12 at 16:52
1  
Thanks for pointing out. Updated code with disposing objects for you. :) –  Deepu Nair Mar 15 '12 at 17:27
1  
check this post Mike. Its exactly what you've asked- stackoverflow.com/questions/1999858/… –  Deepu Nair Mar 15 '12 at 17:40
2  
The $web.Dispose() should be moved up one line so it's inside the loop –  Per Jakobsen Mar 15 '12 at 17:58
show 6 more comments

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

share|improve this answer
    
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 '12 at 14:40
1  
PowerShell tip added –  Per Jakobsen Mar 15 '12 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 '12 at 16:07
add comment

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

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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