Sharepoint顺序工作流未将任务添加到任务列表中

本文关键字:任务 添加 列表 顺序 工作流 Sharepoint | 更新日期: 2023-09-27 18:06:40

将工作流部署到sharepoint站点后,我可以通过创建列表的新行来启动工作流。这些也都反映在领域里,"不"。正在进行的工作流"。但是,我似乎无法在任务列表中找到为特定用户创建的任务。

作为一个Sharepoint开发的初学者,我不确定是什么错了。

Sharepoint顺序工作流未将任务添加到任务列表中

这是我测试的代码:

    private void OnCreateTask_MethodInvoking(object sender, EventArgs e)
    {
        taskId1 = Guid.NewGuid();
        //   SPContentTypeId myContentTypeId=new SPContentTypeId("0x01080100e73fd5f172cb40d8a5dca97fad7a58b8");
        SPContentType myContentType = SPContext.Current.Web.ContentTypes["Powerfull Approval Workflow Task"];
        CreateTaskApproval_ContentTypeID = myContentType.Id.ToString();
        #region Enable ContentTypes
        if (this.workflowProperties.TaskList.ContentTypesEnabled != true)
        {
            workflowProperties.TaskList.ContentTypesEnabled = true;
        }
        bool contenTypeExists = false;
        foreach (SPContentType contentType in workflowProperties.TaskList.ContentTypes)
        {
            if (contentType.Name == myContentType.Name)
            {
                contenTypeExists = true;
                break;
            }
        }
        if (contenTypeExists != true)
        {
            workflowProperties.TaskList.ContentTypes.Add(myContentType);
        }
        myContentType.EditFormUrl = "_layouts/SequentialWorkflow/TaskEdit/TaskEditForm.aspx";
        myContentType.DisplayFormUrl = "_layouts/SequentialWorkflow/TaskEdit/TaskEditForm.aspx";
        myContentType.Update();
        #endregion
        taskProperties.PercentComplete = (float)0.0;
        taskProperties.AssignedTo = myInstantiationData.User;
        taskProperties.DueDate = myInstantiationData.DueDate;
        taskProperties.Description = myInstantiationData.Request;
        taskProperties.StartDate = DateTime.Now;
        taskProperties.Title = "Please approve " + this.workflowProperties.Item.DisplayName;
    }