I'm trying to get "AutoCleaupDays
" property of workflow association but workflowassociation
always returning null. Then I tried with workflowSubscriptionService
& here I am getting my workflow but it does not expose "AutoCleaupDays" property. below is my code
CODE 1: Using SPList.WorkflowAssociations
SPList list = web.Lists.TryGetList("IT-Request-Form");
SPWorkflowAssociationCollection WAC = list.WorkflowAssociations;//Its returing null
System.Globalization.CultureInfo culinfo = new System.Globalization.CultureInfo("en-us");
SPWorkflowAssociation WA = WAC.GetAssociationByName("WorkflowAssociation_5fb922d2693c4b718c652ce7d5eb49ce", culinfo);
int days = WA.AutoCleanupDays;
SPWorkflowAssociationCollection returning null.
CODE 2: Using GetWorkflowSubscriptionService
var workflowServiceManager = new WorkflowServicesManager(web);
var workflowSubscriptionService = workflowServiceManager.GetWorkflowSubscriptionService();
var subscriptions = workflowSubscriptionService.EnumerateSubscriptionsByList(list.ID);
foreach (var workflowSubscription in subscriptions)
{
//here i get "Object reference not set to an instance of an object" exception
string autoCleanupDays = workflowSubscription.GetProperty("AutoCleanupDays").ToString();
//Then i checked Properties & allProperties does not contains "AutoCleanupDays" Property
ICollection<string> allProperties = workflowSubscription.PropertyDefinitions.Keys;
}
So how I get "AutoCleaupDays" value of workflow in SP2013?