Articles about European Sharepoint Hosting Service
SharePoint 2013 Hosting – HostForLIFE.eu :: How to Cancel Workflows Which Are Not Completed
You can cancel all workflows having status not equal to “Completed”. Suppose you have a list which contains more than 1000 items and you realize the workflow which is attached to the list going to Suspended state or in progress state. Here if you want to cancel the workflows which are not completed, then it can not be a manual task when your list is larger. If you have 10/20 items then you can do manually, but in other case manual process is not a good option.
Here, I use a very good way using PowerShell approach to cancel not completed workflows in SharePoint 2013. Below is the PowerShell script:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
#Your Shaeproint Site URL $web = Get-SPWeb "http://yoursharepointserver.com/yoursubsite"; $web.AllowUnsafeUpdates = $true; #Your List Name $list = $web.Lists["YourListName"]; $count = 0 #Loop through all Items in List then loop through all Workflows on each List Items. foreach ($listItem in $list.Items) { foreach ($workflow in $listItem.Workflows) { #Disregard Completed Workflows if(($listItem.Workflows | where {$_.InternalState -ne "Completed"}) -ne $null) { #Cancel Workflows [Microsoft.SharePoint.Workflow.SPWorkflowManager]::CancelWorkflow($workflow); write-output "Workflow cancelled for : " $listItem.Title; } } } $web.Dispose(); |
Hope it works!
SharePoint 2013 Hosting Recommendation
HostForLIFE.eu’s SharePoint 2013 Hosting solution offers a comprehensive feature set that is easy-to-use for new users, yet powerful enough for the most demanding web developer expert. Hosted SharePoint Foundation 2013 is the premiere web-based collaboration and productivity enhancement tool on the market today. With SharePoint 2013 Foundation, you can quickly access and manage documents and information anytime, anywhere though a Web browser in a secure and user friendly way. SharePoint hosting services start at only at €9.99/mo, allowing you to take advantage of the robust feature set for a small business price. HostForLIFE.eu offers a variety of hosted SharePoint Foundation 2013 plans as well as dedicated SharePoint 2013 Foundation options.
Print article | This entry was posted by Matthew Gilbert on August 14, 2015 at 3:04 am, and is filed under European SharePoint 2013 Hosting. Follow any responses to this post through RSS 2.0. You can leave a response or trackback from your own site. |