简体   繁体   中英

Sharepoint Sequential Workflow not adding Task into Tasklist

After the deployment of the workflow onto the sharepoint site, I am able to start the workflow by creating new rows of a list. These are also reflected in the field, "no. of workflow in progress". However, I cannot seem to find the tasks created for specific users in the Task list.

As a beginner with Sharepoint development, I am not exactly sure what is wrong. Please kindly advise.

this is my tested code:

    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;
    }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM