Often it is asked by end-users to preserve the workflow history for out-of-the-box Approval workflows when moving to SharePoint Online (Office 365). Since none of the well-known migration tools supported moving Workflow history as it is, I worked on a workaround idea of my own.
The idea was to give users a familiar text of who approved the task and when that typically appears on the Workflow history page of an Item. This text can be pulled-in from the hidden workflow history list, and, added to a blank text column WorkflowHistory next to the document. Once the workflow data is added in one of the Columns of the document library, it can be migrated like any other column that depicts document’s properties.
For the example below, I created a multiline WorkflowHistory field in the library and populated it with OOB Approval Workflow’s Outcome & Description data pulled-in from the hidden workflow history list using a PowerShell script. Fields – Outcome and Description are queried based on the item id and list id and data from all tasks of workflow on an item is populated.
A PowerShell script automates the process (except few parameters) is available for download below. See details of modification before running it in your SharePoint 2010 or SharePoint 2013 environment.
Download the attached script from below and make the following Changes :
- Change the value for your SharePoint 2010\2013 site in $siteUrl = “{yoursiteurl}” line.
- Change the value for “Documents” to specify your own documnet library in $_list = $_lists.GetByTitle(“Documents“) line.
- Change the folder path to specify folder 14 or 15 as per your SharePoint version. Example, change path in Add-Type -Path “C:\Program Files\Common Files\microsoft shared\Web Server Extensions\14\ISAPI\Microsoft.SharePoint.Client.dll”
The script runs per library, and, runs in batches to take care of 5000+ item threshold. Run it on PowerShell version 3 on your SharePoint 2010 or SharePoint 2013 server.
For questions, drop me a note in the comments below or ask on Twitter or LinkedIn.