public static SPWorkflowAssociation CreateWorkflowAssociation(this SPWeb web, string listUrl, Guid workflowId, string assocName, string workflowTasksListName, string workflowHistoryListName, bool allowManual, bool autoStartCreate, bool autoStartChange) { // Get the workflow template. SPWorkflowTemplate workflowTemplate = web.WorkflowTemplates.GetTemplateByBaseID(workflowId); return(web.CreateWorkflowAssociation(listUrl, workflowTemplate, assocName, workflowTasksListName, workflowHistoryListName, allowManual, autoStartCreate, autoStartChange)); }
public static SPWorkflowAssociation CreateWorkflowAssociation(this SPWeb web, string listUrl, string workflowName, string assocName, string workflowTasksListName, string workflowHistoryListName, bool allowManual, bool autoStartCreate, bool autoStartChange) { // Get the workflow template. SPWorkflowTemplate workflowTemplate = web.WorkflowTemplates.GetTemplateByName(workflowName, CultureInfo.CurrentCulture); return(web.CreateWorkflowAssociation(listUrl, workflowTemplate, assocName, workflowTasksListName, workflowHistoryListName, allowManual, autoStartCreate, autoStartChange)); }
public static SPWorkflowAssociation CreateWorkflowAssociation(this SPWeb web, string listUrl, SPWorkflowTemplate workflowTemplate, string assocName, string workflowTasksListName, string workflowHistoryListName, bool allowManual, bool autoStartCreate, bool autoStartChange) { SPList workflowTasksList = web.Lists.TryGetList(workflowTasksListName) ?? web.Lists[web.Lists.Add(workflowTasksListName, /*"This is workflow tasks list."*/ "", SPListTemplateType.Tasks)]; SPList workflowHistoryList = web.Lists.TryGetList(workflowHistoryListName) ?? web.Lists[web.Lists.Add(workflowHistoryListName, /*"This is workflow history list."*/ "", SPListTemplateType.WorkflowHistory)]; return(web.CreateWorkflowAssociation(workflowTemplate, assocName, workflowTasksList, workflowHistoryList, allowManual, autoStartCreate, autoStartChange)); }
public static SPWorkflowAssociation CreateWorkflowAssociation(this SPWeb web, SPWorkflowTemplate workflowTemplate, string assocName, SPList workflowTasksList, SPList workflowHistoryList, bool allowManual, bool autoStartCreate, bool autoStartChange, bool overwrite = false) { SPWorkflowAssociation workflowAssociation = web.CreateWorkflowAssociation(workflowTemplate, assocName, workflowTasksList, workflowHistoryList, overwrite, assoc => { assoc.AllowManual = allowManual; assoc.AutoStartCreate = autoStartCreate; assoc.AutoStartChange = autoStartChange; }); return(workflowAssociation); }