Sharepoint Approval Work Catch批准按钮

时间:2016-07-28 10:30:45

标签: sharepoint sharepoint-2010 sharepoint-workflow

我在visual studio中创建了Sharepoint Approval 2010工作流程。

如果用户点击批准或拒绝按钮,我该如何捕捉?

private void createTaskWithContentType1_MethodInvoking(object sender, EventArgs e)
{

    createTaskWithContentType1_ContentTypeId1 = "0x01080100C9C9515DE4E24001905074F980F93160003A15057E2AF34B67B32E14B94EB70409";
    createTaskWithContentType1_TaskId1 = Guid.NewGuid();
    createTaskWithContentType1_TaskProperties1.AssignedTo = workflowProperties.Web.SiteAdministrators[0].LoginName;
    createTaskWithContentType1_TaskProperties1.DueDate = DateTime.Now.AddDays(1.0F);
    createTaskWithContentType1_TaskProperties1.Title = "Approval Required for xx";
    createTaskWithContentType1_TaskProperties1.Description = "Specify the approval result here.";

    SPList taskList = workflowProperties.TaskList;

}

private void onTaskChanged1_Invoked(object sender, ExternalDataEventArgs e)
{
 //I think here i have to somehow do:  If button approve clicked .... else if reject button clicked
}

2 个答案:

答案 0 :(得分:2)

我找到了解决方案

private void onTaskChanged1_Invoked(object sender, ExternalDataEventArgs e)
        {
            string taskStatus = onTaskChanged1.AfterProperties.ExtendedProperties["TaskStatus"].ToString();

ExtendedProperties [“TaskStatus”]将返回Approved或Rejected

ExtendedProperties中有更多属性,但您需要进入调试模式才能看到它们。

答案 1 :(得分:1)

您是否创建了自定义任务表单?或OOTB任务表。如果是自定义,则可以直接从自定义任务表单设置值(在保存按钮上)。如果它是OOTB,那么你必须编辑任务表单并添加javscript或JQuery以点击保存按钮。

如果单击“保存”按钮,将会提示。 sharepoint OOTB任务列表表单

function PreSaveItem(){
// add other your codes
if(value == 'confirm'){
  return true; // allow save form...
}

return false; // not allow save form
// use return true; if confirm or return false...
}

了解更多信息,请访问以下链接 https://sharepoint.stackexchange.com/questions/117147/how-to-trigger-the-click-event-of-the-sharepoint-ootb-lists-new-form-save-butto