Skip to main content

Posts

Showing posts with the label workflow history

Mighty SharePoint Workflows - part 3 - workflow history and audit solutions

I came across the limitation of the workflow history in SharePoint the other day. After 60 days the history is cleaned up. Technically it's the right way of doing things in SharePoint, because workflow history is a list and if we have more than 2000 records in the list we have performance issues. There are some blog posts about that issue. The main one: Huge MOSS Workflow Issue... What is Microsoft Thinking!!!! The other linked to the issue: SPWorkflowAssociation.AutoCleanupDays I worked with several clients on custom workflows for SharePoint and we created the separate audit database where all the SharePoint workflow activity information and list/library item information is stored. For guys who have already created workflows in SharePoint or use standard SharePoint workflows - like Approval etc. - and they are not sure what to do the solution is to develop or purchase a tool to migrate their workflow history to separate database on a regular basis. I can help with that...

Mighty SharePoint Workflows - part 2 - workflow statistics, workflow tasks, workflow history

The task 1. Get links to workflow statistics. 2. Get workflow tasks programmatically. 3. Get workflow history programmatically Solution 1. Links to workflow statistics: foreach (SPWorkflow wf in list_item.Workflows) { string sLink = string.Format("{0}/_layouts/WrkStat.aspx?List={1}&WorkflowInstanceID={2}", web.Url, wf.ListId, wf.InstanceId) } web.Url above is the Url property of SPWeb instance. 2. Workflow tasks: foreach (SPWorkflowTask wt in wf.Tasks) { // get any information you like about the wt object, i.e. in this scenario we will output link to the task string sLink = string.Format("{0}/Lists/{1}/DispForm.aspx?ID={2}", web.Url, SPEncode.UrlEncode(wt.ParentList.Title), wt["ID"]) ... } 3. Workflow history: Class SPWorkflow has a member HistoryList which represents history list for the workflow. Let's assume that we are using the SPWorkflow object - wf - from above. 3.1. First we have to make a query to extract history list item ...