First published on TECHNET on Jan 22, 2015
Sooooooo you have figured out that you disabled the Workflow History Cleanup timer job, and now realize the mistake you made....
My customer recently found themselves in that position, this customer had done this to allow a Site Collection to use that data for auditing purposes and as I said a few weeks ago this is a mistake, see previous blog for more info. Sadly they could not just enable the job and go on there merry way, they had to export that data and keep it somewhere for the Site Collection owner could go back and review when needed.
I wrote this PowerShell script to do just that for them. Here is what I did
In the script there are a few tricks I had to do to complete the job, and I would like to point them out
1. Get all Workflow history lists title into an array, I used the SPList Porperty BaseTemplate
2. The list items data for the event is a number and thanks to the author of this article http://www.spjeff.com/2010/01/29/workflow-history-event-type-numbers-decoded-2/ I was able to use a simple switch statement to translate the number to provide a more descriptive event.
3. To extract the name of a document for the workflow I had to take several steps
a. Create a regexpattern to find url of documents
b. Then manipulate the data to get the name of the document
If you would like to please download the script from here
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.