Tag Archives: Workflow Auto Cleanup workflow history disappears
来源:互联网 发布:文明5手机版java 编辑:程序博客网 时间:2024/05/16 10:20
SharePoint Workflow History “Disappears”
By default, workflow history will "disappear" after 60 days. Microsoft has built this into MOSS intentionally to ensure good performance. By deleting old workflow history, it’s more likely (but hardly guaranteed) that the Workflow History list (/Lists/Workflow History by default) will stay below the magic 2000 items per list limit. (See the "Working with Large Lists in Office SharePoint Server 2007" white paper for details on this limit.)
The official Microsoft answer to this in Technet is to disable the Workflow Auto Cleanup Timer Job. Unfortunately, this is a farm-level setting and will affect every Site Collection in your farm, which may be more far-reaching than you intend. However, it might be the right solution for you.
Another option is to run some code to change the time length for the history retention. There is somegood code and discussion here (I’m reproducing the code below in case the link changes. Thanks to Shola Salako! I haven’t tested this code, so use it carefully.) to do this by changing the value of SPWorkflowTemplate.AutoCleanupDays on specific lists. NOTE: Don’t use the SQL method! Running the C# example which utilizes the object model is perfectly legitimate, but poking around in the database will leave you in what Microsoft calls an "unsupported state" and is just a bad idea.
For companies that rely on workflow history for auditing and regulatory compliance, taking one of these actions is going to be critical.
1: /*
2: * Date: September 17, 2007
3: *
4: * Program Description:
5: * ====================
6: * This program is a workaround for Microsoft Office SharePoint Server 2007
7: * bug #19849, where the AutoCleanupDays is set to 60 by default and by design
8: * in MOSS installations. This program gives the customer the opportunity to
9: * change this number.
10: * Workflow histories would not show after 60 days by default.
11: */
12: using System;
13: using System.Collections.Generic;
14: using System.Text;
15: using Microsoft.SharePoint;
16: using Microsoft.SharePoint.Workflow;
17:
18: namespace ShowWFs
19: {
20: class Program
21: {
22: static string siteName;
23: static int newCleanupDays, assoCounter;
24: static string libraryName, wfAssoName;
25: static SPSite wfSite;
26: static SPWeb wfWeb;
27: static SPList wfList;
28: static void Main(string[] args)
29: {
30: try
31: {
32: switch (args.Length)
33: {
34: case 0: //no parameters entered by user
35: {
36: System.Console.WriteLine("Error: No arguments entered (site, library, workflow and days)");
37: showHelpUsage();
38: break;
39: }
40: case 4: //correct number of parameters
41: {
42: siteName = args[0];
43: libraryName = args[1];
44: wfAssoName = args[2];
45: newCleanupDays = Convert.ToInt32(args[3]);
46: assoCounter = 0;
47: wfSite = new SPSite(siteName);
48: wfWeb = wfSite.OpenWeb();
49: wfList = wfWeb.Lists[libraryName];
50: SPWorkflowAssociation _wfAssociation = null;
51: foreach (SPWorkflowAssociation a in wfList.WorkflowAssociations)
52: {
53: if (a.Name == wfAssoName)
54: {
55: a.AutoCleanupDays = newCleanupDays;
56: _wfAssociation = a;
57: assoCounter++;
58: }
59: else
60: {
61: _wfAssociation = a;
62: }
63: }
64: wfList.UpdateWorkflowAssociation(_wfAssociation);
65: System.Console.WriteLine("n" + wfAssoName + ": " + assoCounter.ToString() + " workflow association(s) changed successfuly!n");
66: break;
67: }
68: default: //default number of parameters
69: {
70: System.Console.WriteLine("Incorrect number of arguments entered (" + args.Length.ToString() + " arguments)");
71: showHelpUsage();
72: break;
73: }
74: }
75:
76: }
77: catch (Exception e)
78: {
79: System.Console.WriteLine("An error has occurred. Details:n" + e.ToString());
80: }
81: finally
82: {
83: if (wfSite != null)
84: wfSite.Dispose();
85: if (wfWeb != null)
86: wfWeb.Dispose();
87: System.Console.WriteLine("nFinished setting AutoCleanupDays!");
88: }
89: }
90: static void showHelpUsage() //help screen
91: {
92: System.Console.WriteLine("nnMOSS Workflow Set AutoCleanup Usage:");
93: System.Console.WriteLine("====================================");
94: System.Console.WriteLine("ShowWFs siteURL library workflow days");
95: System.Console.WriteLine(" - siteURL (e.g. http://serverURL/site)");
96: System.Console.WriteLine(" - library (e.g. "Shared Documents")");
97: System.Console.WriteLine(" - workflow (e.g. "Approval")");
98: System.Console.WriteLine(" - days for auto clean up (e.g. 120)");
99: }
100: }
101: }
- Tag Archives: Workflow Auto Cleanup workflow history disappears
- Workflow
- Workflow
- workflow
- workflow
- workflow
- workflow
- ORACLE EBS WORKFLOW 如何隐藏 ACTION HISTORY
- 初涉Workflow
- realtime workflow
- Workflow Draft
- Workflow Pattern
- ActionServlet workflow
- SimpleFormController workflow
- Workflow概述
- OS Workflow
- 工作流(Workflow)
- 八.workflow
- POJ 2393-Yogurt factory 贪心算法
- 文件属修改器!(创建时间、修改时间等属性修改)
- linux下出现undefined reference to `mysql_init' 的解决方法
- Linux下的多线程编程
- 错误集锦5--“std::ios_base::Init::Init()”,referenced from 错误
- Tag Archives: Workflow Auto Cleanup workflow history disappears
- 关于Activity的启动模式,你知道吗?
- Cocos2d-x 触摸响应事件CCTouchDelegate
- SharePoint 2013 创建web应用程序报错"This page can’t be displayed"
- java从入门到精通_接口技术
- 浅谈位运算
- 第五十六题(最长公共子串)
- coco2dx shader内置变量和函数
- JAVA学习_1基础