Nishand's Blog

Welcome to my personal blog, All the information in this bogs is my ideas,findings and thoughts on .Net, Asp.Net and SharePoint.
ALL POSTING ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND

Changing the SPWorkflowAssociation.AutoCleanupDays property

By default the SPWorkflowAssociation.AutoCleanupDays property value is set to ‘60’ days, to set this property we need to call the SPList.UpdateWorkflowAssociation(SPWorkflowAssociation) function, SPWeb.Update() won’t work here.

 

   1: SPSite site = new SPSite("<http://nishandv3:100/sites/DevSite/>");
   2: SPWeb web = site.OpenWeb();
   3: SPWorkflowTemplateCollection collection = web.WorkflowTemplates;
   4: SPList list = web.Lists["Shared Documents"];
   5: SPWorkflowAssociation _asso = null;
   6: foreach (SPWorkflowAssociation asso in list.WorkflowAssociations)
   7: {
   8: if (asso.Name == "Approval")
   9: {
  10: asso.AutoCleanupDays = 100;
  11: _asso = asso;
  12: }
  13: }
  14: list.UpdateWorkflowAssociation(_asso); 

 

Hope this works for you!

Published Monday, September 10, 2007 11:57 PM by nishandv
Anonymous comments are disabled

© 2009 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Microsoft
Page view tracker