0

在将工作流部署到共享点站点后,我可以通过创建列表的新行来启动工作流。这些也反映在“正在进行的工作流数量”字段中。但是,我似乎无法在任务列表中找到为特定用户创建的任务。

作为 Sharepoint 开发的初学者,我不确定哪里出了问题。请多多指教。

4

1 回答 1

0

这是我测试过的代码:

    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;
    }
于 2013-04-01T09:02:45.757 回答