4

I had a workflow create a new version every 5 minutes for two weeks. It has caused a pretty big mess and the history is taking up a lot of space. I have fixed the workflow, deleted all the version history and I'm deleting items out of the Workflow History list right now. The area that I'm stuck in is the completed workflow history inside of list item its self. I don't have central administration access, so I can't run a script to delete it. I do have access to Designer. I tried removing the workflows and then publishing them again, that did not remove the history. The list is currently 700 MB with only 250 list items inside of it. There are no attachments in the list. Any suggestions on how to get ride of the completed workflow history would be greatly appreciated.

user2100632
  • 121
  • 11

1 Answers1

3

You can easily do this using the object model and PowerShell:

$spweb = Get-SPWeb http://sps-server/website
$splist = $spweb.Lists["YourList"]
$spitem = $splist.GetItemById(1)
$spitem.Workflows | % { $web.Site.WorkflowManager.RemoveWorkflowFromListItem($_) }
Goyuix
  • 23,614
  • 14
  • 84
  • 128
PRB
  • 1,031
  • 11
  • 27
  • If the user doesn't have access to Central Admin, will he be able to execute powershell? Alternatively similar .NET code which can be used in webpart is available @http://social.technet.microsoft.com/wiki/contents/articles/4839.sharepoint-2010-how-to-delete-completed-workflow-instances.aspx – Vivek Athalye Jan 09 '15 at 04:53
  • 1
    @VivekAthalye that assumes that the user is the actual administrator, otherwise he wouldn't be able to install the web part! As for the code - the two code blocks use the same method and classes. Creating a UI component to do an admin script's job is a bit of an abuse – Panagiotis Kanavos Jan 09 '15 at 15:28