Changing the SPWorkflowAssociation.AutoCleanupDays property

This MSDN Post Is From Nishand’s Blog:

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( ” ” ); 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!

Continue Reading On MSDN:
Changing the SPWorkflowAssociation.AutoCleanupDays property

  • Share/Bookmark

No Comments »

No comments yet.

RSS feed for comments on this post. TrackBack URL

Leave a comment