2

I got a workflow which needs an approval from someone using Outlook, we've transferred or copied this SharePoint site into a new one and then decommissioned the old one.

However, some emails are still being sent from this 'old' SharePoint site, so I wanted to check the workflow instances that are still running on the old page.

I've deleted the List from the old one, including all the workflows and cleared its recycle bin - yet to no avail.

So here I am, asking if there's a way to monitor ALL the active workflow instances so that I'll be able to stop the pesky ones from being active and stop them from sending the emails.

(Please note that yes, I can see all the active instances count on the Workflows page, yet I'm unable to manage them one by one.)

6
  • Enterprise or Online? As you tagged this question with both. Sep 4, 2017 at 7:59
  • My apologies on that one, upon checking - we're using SharePoint Server 2013. Sep 4, 2017 at 8:52
  • Then my next question is, the title says 2010. Do you mean the 2010 workflow engine or do you have workflow 2013? Sep 4, 2017 at 8:58
  • Wrong input, everything was made in SharePoint server 2013. Sep 4, 2017 at 9:05
  • Allright, but are the workflows created as 2013 or 2010 workflows? You can see that from SPD. Sep 4, 2017 at 9:08

3 Answers 3

1

You can try to execute powershell script on the SharePoint server. This should give you info on all the working SharePoint workflow on the server -

#Load SharePoint snap-in 
Add-PSSnapin Microsoft.SharePoint.PowerShell 

#Fetches webapplications in the farm 
$WebApplications = Get-SPWebApplication -IncludeCentralAdministration     

foreach($WebApplication in $WebApplications){ 
  #Fetches site collections list within sharepoint webapplication 
  Write-Output "" 
  Write-Output "Working on web application $($WebApplication.Url)" 
  $Sites = Get-SPSite -WebApplication $WebApplication -Limit All     

  foreach($Site in $Sites)
  {      
    #Fetches information for each  site - old code 
    $site = Get-SPSite($Site.Url);
    $site.AllWebs | foreach { $_.Lists | foreach { $_.WorkflowAssociations | foreach { 
  write-host "Site:" $_.ParentWeb.Url ", List:" $_.ParentList.Title ", Workflow:" $_.Name
} } }

    $Site.Dispose() 
  } 
 } 
 #Unload SharePoint snap-in 
Remove-PSSnapin Microsoft.SharePoint.PowerShell 

Script is not tested

3
  • This script works on our farm. However it "only" shows the workflows for the site collection you specify in the first line. Is there a way to extend this to the entire farm? (I'm a Powershell beginner)
    – AM2FTW
    Sep 21, 2017 at 14:33
  • Updated the script to include all sites in farm Sep 22, 2017 at 4:43
  • Wow Thank you! Works like a charm on my end, hope it works for others too. +1
    – AM2FTW
    Sep 22, 2017 at 5:47
2

.WorkflowInstanceService.EnumerateInstancesForSite method (Int32) https://msdn.microsoft.com/en-us/library/office/jj252632.aspx

In theory, this is supposed to allow you to enumerate all of the executing instances. I'm trying to use it in OnPrem 2013, using JavaScript, and I can definitely say that it doesn't work. I have two item workflows in a suspended state, and the code doesn't not find either of them. I can't easily post all my code, but I've followed every example that I've found, including ensuring that all of the libraries are loaded. All the code runs, it just always returns a zero(0) for the instances.getEnumerator()

Maybe your luck will be better.

0

If this is related to a list/library then try below.

1.Check using Power shell is any item from list/library has any workflow running.

2.Also go to the SharePoint list/library and click workflow settings from top ribbon. Remove all workflow instances manually.

Add-PSSnapin Microsoft.SharePoint.Powershell $url = "http://server/sites/devsite/CCTrans/" $listName = "TestList";

$SPSite = New-Object Microsoft.SharePoint.SPSite($url) $SPWeb = $SPSite.OpenWeb() $SPList = $SPWeb.Lists[$listName]

$spqQuery = New-Object Microsoft.SharePoint.SPQuery $splListItems = $SPList.GetItems()

foreach ($item in $splListItems) { #$item["ReadyForArchival "] = "1"; #$item.Update();

foreach ($wf in $item.Workflows) 
{
    #Write-Output ("All workflows");
    if(($wf | where { ($_.InternalState -ne "Completed") }) -ne $null) #Error Occurred
    {
         Write-Output ("running WF" + $_.InternalName);
         Write-Output ("Item ID :"  + $wf.ItemId);
    }
}

}

Your Answer

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

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