none
Locating active workflows within a site

    Question

  • I have a pretty large site with mulitple subsites that containg multiple libraries and list. I'm running into a problem where we have mulitple workflows, but I have no idea where in the site they are located. I know you can view how many workflows are in progress in "Site Collection Workflows", but it doesn't tell you where in the site the workflows are located. Is there a tool or custom webpart I could use that would tell me where in the site there workflows are located?

    Thanks in advance,
    Dex

    Tuesday, May 05, 2009 3:33 PM

Answers

  • The following code works


                SPSite site = new SPSite("<your site>");
                foreach (SPWeb web in site.AllWebs)
                {
                    Console.WriteLine("workflow running in this site:{0}", web.Title);
                    foreach (SPList list in web.Lists)
                    {
                        Console.WriteLine("workflow running in this List:{0}",list.Title );
                       foreach (SPListItem item in list.Items)
                        {
                          
                            foreach (SPWorkflow wf in item.Workflows)
                            {
                               
                                Console.WriteLine(wf.ParentAssociation.Name);
                               
                            }


                        }
                    }
                }


    Serge Luca; blog: www.redwood.be
    Wednesday, May 06, 2009 7:36 PM
  • SPWorkflowManager.GetActiveWorkflows() return active workflows on a listitem; you can write a web part that calls this method on every item in every list; it is very simple and is the absolute weapon!

    or SPListItem.Workflows()....


    Serge Luca; blog: www.redwood.be
    Wednesday, May 06, 2009 7:12 PM
  • Hi,

    I suppose the workflows means workflow associations.

     

    SharePoint Server stores the workflow association data of a list or document library in the WorkflowAssociation table in the SharePoint content database.

    The WorkflowAssociation table stores the association between the workflow itself (using its workflow.xml GUID, which is stored in the BaseID column), the list or document library GUID, the task list GUID, the Workflow History GUID, the Web GUID, the auto-cleanup date of the Workflow History list, and the permissions.

     

    See Developing Workflow Solutions with SharePoint Server 2007 and Windows Workflow Foundation (http://msdn.microsoft.com/en-us/library/cc514224.aspx) for more information.

     

    If you want to get them, please refer to Serge Luca’s suggestions.

     

    Hope the information can be helpful.

    -lambert


    Lambert Qin | Microsoft Online Support Engineer
    How to ask a question in the forum (http://support.microsoft.com/kb/555375)
    Posting is provided "AS IS" with no warranties, and confers no rights.
    Thursday, May 07, 2009 6:48 AM

All replies

  • Tuesday, May 05, 2009 4:46 PM
  • Thanks Frank.

    It's not quite what I was looking for, but it's a start.
    Wednesday, May 06, 2009 2:17 PM
  • SPWorkflowManager.GetActiveWorkflows() return active workflows on a listitem; you can write a web part that calls this method on every item in every list; it is very simple and is the absolute weapon!

    or SPListItem.Workflows()....


    Serge Luca; blog: www.redwood.be
    Wednesday, May 06, 2009 7:12 PM
  • The following code works


                SPSite site = new SPSite("<your site>");
                foreach (SPWeb web in site.AllWebs)
                {
                    Console.WriteLine("workflow running in this site:{0}", web.Title);
                    foreach (SPList list in web.Lists)
                    {
                        Console.WriteLine("workflow running in this List:{0}",list.Title );
                       foreach (SPListItem item in list.Items)
                        {
                          
                            foreach (SPWorkflow wf in item.Workflows)
                            {
                               
                                Console.WriteLine(wf.ParentAssociation.Name);
                               
                            }


                        }
                    }
                }


    Serge Luca; blog: www.redwood.be
    Wednesday, May 06, 2009 7:36 PM
  • Hi,

    I suppose the workflows means workflow associations.

     

    SharePoint Server stores the workflow association data of a list or document library in the WorkflowAssociation table in the SharePoint content database.

    The WorkflowAssociation table stores the association between the workflow itself (using its workflow.xml GUID, which is stored in the BaseID column), the list or document library GUID, the task list GUID, the Workflow History GUID, the Web GUID, the auto-cleanup date of the Workflow History list, and the permissions.

     

    See Developing Workflow Solutions with SharePoint Server 2007 and Windows Workflow Foundation (http://msdn.microsoft.com/en-us/library/cc514224.aspx) for more information.

     

    If you want to get them, please refer to Serge Luca’s suggestions.

     

    Hope the information can be helpful.

    -lambert


    Lambert Qin | Microsoft Online Support Engineer
    How to ask a question in the forum (http://support.microsoft.com/kb/555375)
    Posting is provided "AS IS" with no warranties, and confers no rights.
    Thursday, May 07, 2009 6:48 AM
  • Thanks guys for all your help!!!!
    Monday, May 11, 2009 1:49 PM