The workflow data is purged from the MOSS Workflow database table after 60 days. Based on calls to Microsoft about this, it was by design and for performance reasons. However, what good it the workflow functionality if proof of the workflows are deleted? How can companies meet various industry auditing requirements for SOX, ISO, TS, etc? Microsoft gave us only one option: changing the 60 days to something higher by writing a script modifying the SPWorkflowTemplate.AutoCleanupDays property of the workflow associations. But this does not bring the deleted data back? I wrote a comprehensive script for this…let me know if you need it.
For anyone seriously considering using the MOSS workflows, I would advise you disable the “Workflow Auto Cleanup” timer service in Central Admin (central –> Operations –>Timer Job Definitions) to prevent any further deletions of your workflow data.
the workflow will use a hidden list “Workflow History”. Using .Net code running on one of your servers, get a handle to the list “Workflow History”, set Hidden = false on the list, and update() the list to save the change. Once the Workflow History list is visible, you can view it on the web like http://server.domain.tld/lists/Workflow%20History/AllItems.aspx. You can then browse through the history by date to find the workflow you’re interested in.
Here is the script. Compile in VS and run on MOSS box with account that has MOSS admins rights (MOSS service account, maybe).
/*
* Date: September 17, 2007
*
* Program Description:
* ====================
* This program is a workaround for Microsoft Office SharePoint Server 2007
* bug #19849, where the AutoCleanupDays is set to 60 by default and by design
* in MOSS installations. This program gives the customer the oppotunity to
* change this number.
* Workflow histories would not show after 60 days by default.
*/
using
System;
using
System.Collections.Generic;
using
System.Text;
using
Microsoft.SharePoint;
using
Microsoft.SharePoint.Workflow;
namespace
ShowWFs
{
class Program
{
static string siteName;
static int newCleanupDays, assoCounter;
static string libraryName, wfAssoName;
static SPSite wfSite;
static SPWeb wfWeb;
static SPList wfList;
static void Main(string[] args)
{
try
{
switch (args.Length)
{
case 0: //no parameters entered by user
{
System.
Console.WriteLine(“Error: No arguments entered (site, library, workflow and days)”);
showHelpUsage();
break;
}
case 4: //correct number of parameters
{
siteName = args[0];
libraryName = args[1];
wfAssoName = args[2];
newCleanupDays =
Convert.ToInt32(args[3]);
assoCounter = 0;
wfSite =
new SPSite(siteName);
wfWeb = wfSite.OpenWeb();
wfList = wfWeb.Lists[libraryName];
SPWorkflowAssociation _wfAssociation = null;
foreach (SPWorkflowAssociation a in wfList.WorkflowAssociations)
{
if (a.Name == wfAssoName)
{
a.AutoCleanupDays = newCleanupDays;
_wfAssociation = a;
assoCounter++;
}
else
{
_wfAssociation = a;
}
}
wfList.UpdateWorkflowAssociation(_wfAssociation);
System.
Console.WriteLine(“\n” + wfAssoName + “: “ + assoCounter.ToString() + ” workflow association(s) changed successfuly!\n”);
break;
}
default: //default number of parameters
{
System.
Console.WriteLine(“Incorrect number of arguments entered (“ + args.Length.ToString() + ” arguments)”);
showHelpUsage();
break;
}
}
}
catch (Exception e)
{
System.
Console.WriteLine(“An error has occurred. Details:\n” + e.ToString());
}
finally
{
if (wfSite != null)
wfSite.Dispose();
if (wfWeb != null)
wfWeb.Dispose();
System.
Console.WriteLine(“\nFinished setting AutoCleanupDays!”);
}
}
static void showHelpUsage() //help screen
{
System.
Console.WriteLine(“\n\nMOSS Workflow Set AutoCleanup Usage:”);
System.
Console.WriteLine(“====================================”);
System.
Console.WriteLine(“ShowWFs siteURL library workflow days”);
System.
Console.WriteLine(” – siteURL (e.g. http://serverURL/site)”);
System.
Console.WriteLine(” – library (e.g. \”Shared Documents\”)”);
System.
Console.WriteLine(” – workflow (e.g. \”Approval\”)”);
System.
Console.WriteLine(” – days for auto clean up (e.g. 120)”);
}
}
}
Check here for more details
http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=2041818&SiteID=1