This is for performance considerations, courtesy of the Workflow Auto Cleanup timer job in the config section.
Three options to consider:
- Disable the Workflow Auto Cleanup timer job completely. (Please note that this might have serious performance implications, and should be planned carefully)
- Include a specific xml tag in your workflow feature.xml file that controls the number of days retained for the workflow history (max days = 9999)/li>
- Run a job nightly to force all the workflow history retention settings to a certain number of days (max days = 9999)
To set the time schedule for when the scan will occur to delete workflow data for the Web application, http://test, use the following syntax:
stsadm -o setproperty -pn job-workflow-autoclean -pv "daily at 15:00:00" -url http://test
To view the current setting of the job-workflow-autoclean property, use the following syntax:
stsadm -o getproperty -pn job-workflow-autoclean -url http://test
- You can modify this setting using the SharePoint object model - as Robert's postings suggest take a look at the SPWorkflowAssociation.AutoCleanupdays property. Take a look at the next code sample
using (SPSite sitecollection = new SPSite("http://moss:99"))
{using(SPWeb site = sitecollection.OpenWeb("/demo")){ SPWorkflowAssociation _assoc = null; SPList list = site.Lists["Shared documents"]; foreach (SPWorkflowAssociation assoc in list.WorkflowAssociations) { if (assoc.Name == "WFDemo") { _assoc = assoc; _assoc.AutoCleanupDays = 2; } } list.UpdateWorkflowAssociation(_assoc); list.Update();
}
}
No comments:
Post a Comment