Home » SharepointRSS

How to delete the contents of the Workflow History List

I'm trying to purge the contents of the workflow history list which has thousands of comments added by the some workflows (I will fix the workflows later!). I'm worried that the huge number of entries in this list is slowing down the site performance. At this stage I do not need any of these entries for any audting or other purpose. I'm not sure of the best way to go about this.

My current strategy is to rely on the workflow autoclean sp timer job, after first running some code to set the AutoCleanupDays property of the SPWorkflowAssociation. I'm hoping that once I have run this on all the document libraries in my site where workflows have been run I will then be able to delete the Workflow History list using the Sharepoint Web UI "Delete this list" hyperlink.

When I do this at them moment I get an error as below:

 

Operation aborted (Exception from HRESULT: 0x80004004 (E_ABORT))   at Microsoft.SharePoint.Library.SPRequestInternalClass.DeleteList(String bstrUrl, String bstrListName, UInt32 dwDeleteOp, Guid& pgDeleteTransactionId)
   at Microsoft.SharePoint.Library.SPRequest.DeleteList(String bstrUrl, String bstrListName, UInt32 dwDeleteOp, Guid& pgDeleteTransactionId)

If anyone can confirm whether this approach will work or if there is a better way to do this I will be very happy!

 

5 Answers Found

 

Answer 1

 

But I don’t suggest you to do it and you can just change the timer job schedule to run it more frequently.

 


That is not true.  The "Workflow Auto Cleanup " timer job in SharePoint only deletes the workflow associations.  It does not delete items in the Workflow History list.

That timer job uses the AutoCleanupDays property to determine how old the associations should be before it deletes them.

Microsoft leaves it up to us to actually delete the items in the Workflow History list...

 

Answer 2

ThePrior21,

I had the same problem with the workflow history lists getting too large.  After doing some digging, I found out that the timer job (Workflow Auto Cleanup) only deletes the association between the item in a list (Document Library / Form Library / etc.) & it's associated item in the Workflow History list.  It does not delete items from the Workflow History list.

I ended up writing a console application that deletes the items from the Workflow History list, and then deletes them from the Recycle Bin.  First I use it to get the list to a manageable size, then I run it on individual lists each night to make sure they stay small.

Reply to this thread with an email address if you would like a copy of it - I'll send the source code as well.

Thanks,
Tim

 

Answer 3

Hi Tim,

I suspect we have a substantial workflow history list on our SharePoint Site, so I'd be interested to receive a copy of your console application and source code,.

Thanks,

Brian

 

Answer 4

Is it possible to send me the details also. We are having the exact same problem. Out workflow history list is huge and can not delete going through the web link.  danny.georgiadis@bdc.ca
 

Answer 5

Hi,

 

You can go to the workflow  history list  through http://sharepointsite/lists/workflow history  and then delete  it like deleting a common list.

 

But I don’t suggest you to do it and you can just change the timer job schedule to run it more frequently.

 

Hope it is helpful!

 
 
 

<< Previous      Next >>


Microsoft   |   Windows   |   Visual Studio   |   Follow us on Twitter