代码之家  ›  专栏  ›  技术社区  ›  Shiraz Bhaiji

以编程方式将SharePoint工作流添加到列表

  •  8
  • Shiraz Bhaiji  · 技术社区  · 15 年前

    我们正在使用SharePoint Foundation 2010。

    我们创建了一个检查任务列表状态的工作流。

    如果我们将工作流与sharepointui中的列表相关联,它就可以正常工作。

    1 回复  |  直到 15 年前
        1
  •  10
  •   Marek Grzenkowicz    15 年前
    // 1. create an instance of the SPWorkflowAssociation class
    SPWorkflowAssociation workflowAssociation =
      SPWorkflowAssociation.CreateListAssociation(workflowTemplate, associationName, taskList, historyList);
    
    // 2. set start options
    workflowAssociation.AllowManual = true;
    workflowAssociation.AutoStartChange = false;
    workflowAssociation.AutoStartCreate = false;
    
    // 3. set additional association options (if any)
    workflowAssociation.AssociationData = associationData;
    
    // 4. add workflow association to the list
    list.WorkflowAssociations.Add(workflowAssociation);
    
    // 5. enable workflow association, so it is displayed in the user interface
    workflowAssociation.Enabled = true;