0

Sharepoint 2010의 visualstudio 2010에서 승인 워크 플로를 만듭니다. 워크 플로는 처음에 작업을 생성 한 다음 작업 승인을 기다립니다. 그러나 작업이 승인되었는지 확인하는 방법은 무엇입니까? 내가 추가 한 후 reviewd받을 필요가 항목의 목록을 가지고승인 상태 받기

  • :

    Perhabs 나는 좀 더 자세한 내 szebario을 설명합니다.

  • 는 승인 또는 그것이 앱솔루트 decission하고 항목이 거절됩니다 경우 메일을 보내해야 일부 기능이
  • 을 해고해야 승인됩니다 경우 결코이
  • 을 변경해서는 안 거절받을 경우!

내 아이디어 :

아이디어 - 워크 플로우은 :

내 첫번째 생각은 ListItemd 추가 한 후 해고 워크 플로를 만드는 것이 었습니다. WF는 검토 할 수있는 작업을 만들어야합니다. 긍정적 인 경우 일부 기능을 실행하고 자체 기능을 삭제해야합니다.

암 것두 기억 안나 워크 플로우 디자인 : enter image description here

암 것두 기억 안나 워크 플로우 코드 :

 public Guid workflowId = default(System.Guid); 
      public SPWorkflowActivationProperties workflowProperties = new SPWorkflowActivationProperties(); 
      // these properties are for the workflow task that will be created. 
      public SPWorkflowTaskProperties CreateTaskApproval_TaskProperties = new SPWorkflowTaskProperties(); 
      public SPWorkflowTaskProperties CreateTaskApproval_AffterTaskProperties = new SPWorkflowTaskProperties(); 
      public SPWorkflowTaskProperties CreateTaskApproval_BeforeTaskProperties = new SPWorkflowTaskProperties(); 
      public String CreateTaskApproval_ContentTypeId = default(System.String); 
      public Int32 CreateTaskApproval_ListItemId = default(System.Int32); 
      public Guid CreateTaskApproval_TaskId = default(System.Guid); 

     private void createTask1_MethodInvoking(object sender, EventArgs e) 
      { 
       createTask1.TaskId = new Guid(); 
       // Now create the approval task. 
       // Set up some of the properties. 
       CreateTaskApproval_TaskId = Guid.NewGuid(); 
       //Setting the task properties 
       CreateTaskApproval_TaskProperties.Title = "TestTitle" 
       CreateTaskApproval_TaskProperties.Description = "Description"; 
       CreateTaskApproval_TaskProperties.AssignedTo = @"testemail\testuser"; 
       CreateTaskApproval_TaskProperties.SendEmailNotification = false; 
       CreateTaskApproval_TaskProperties.TaskType = 1; 
       LogComment("Request Task Created."); 
      } 
     private void onTaskChanged1_Invoked(object sender, ExternalDataEventArgs e) 
      { 
       try 
       { 
//!!!! The Problem is here at Status 
        // Check to make sure the field is there on the item. 
        if (CreateTaskApproval_TaskProperties.ExtendedProperties["Status"] != null) 
        { 
         // Evaluate the value of the field. 
         if (CreateTaskApproval_TaskProperties.ExtendedProperties["Status"].ToString() == "Approved" || CreateTaskApproval_TaskProperties.ExtendedProperties["Status"].ToString() == "Declined") 
         { 

          TaskApproval_ApproveComplete = true; 

         } 
         else 
         { 
          TaskApproval_ApproveComplete = false; 
         } 
        } 
        else 
        { 
         // This should never happen because there is a default, but always good just in case. 
         TaskApproval_ApproveComplete = false; 
        } 
       } 
       catch (Exception ex) 
       { 
        TaskApproval_ApproveComplete = false; 

        LogComment(ex.ToString()); 
       } 
      } 
      private void completeTask1_MethodInvoking(object sender, EventArgs e) 
      { 
       workflowProperties.Item.ModerationInformation.Status = SPModerationStatusType.Approved; 
    //Fire some code 

      } 

아이디어 - 작업 흐름 - 문제 : 나는 모든 작업 검토 상태를 얻을 수 없습니다. ("승인 됨"등등)

CreateTaskApproval_TaskProperties.ExtendedProperties["Status"] 

알고 계신가요?

+0

나는이 스택 포인트 - 스탁 익스체인지 사이트 (이 경우 sharepoint.stackexchange.com)를 계속 사용하는 것이 좋습니다. http://meta.stackexchange.com/questions/64068/is-cross-posting-a-question-on-multiple-stack-exchange-sites-permitted-if-the-qu –

+0

http : //의 "Duplicate" sharepoint.stackexchange.com/questions/40678/diasable-approvement-for-a-single-listitem –

+0

죄송하지만 결과가 없으면 어제 simmilar 질문을했습니다! 그게 내가 다른 솔루션을 찾기 위해 노력한 이유이다. (sharepoint.stackexchange에 내 질문에 쓴 것처럼)! 사용자의 답변 후 나는 더 자세한 내 문제를 discribed. 여기에 세부 정보도 추가했습니다. 왜냐하면 여기에서도 유용 할 수 있기 때문입니다. – HW90

답변

1

변경 후 작업 상태 - 디자이너의 AfterProperties에서 가져올 수 있습니다. 그런 다음 onTaskChanged1의 "Invoked"핸들러를 사용하여 AfterProperties 객체로 이동하고 ExtendedProperties [ "isApproved"]를 가져와 작업 승인을 확인해야합니다.

예 방법 :

private void Invoke_Task1_TaskChanged(object sender, ExternalDataEventArgs e) 
    { 
     Task1_IsCompleted = bool.Parse(task1_AfterProperties.ExtendedProperties["isFinished"].ToString()); 
     Task1_IsApproved = bool.Parse(task1_AfterProperties.ExtendedProperties["isApproved"].ToString()); 

     if (Task1_IsCompleted) 
     { 
      ManagerReason = task1_AfterProperties.ExtendedProperties["ManagerReason"].ToString(); 
     } 
    } 

그것이 도움이되기를 바랍니다.

+0

답변 해 주셔서 감사합니다. 당신의 아이디어를 시도한다면! 그러나 나는 "객체의 인스턴스로 설정되지 않은 객체 참조"를 얻는다. 예외! – HW90

+0

그런 다음 어디에서 발생하는지 확인하고 null을 확인하여 적절한 논리 흐름을 적용하여 IsCompleted 또는 IsApproved를 해결합니다. –

+0

이 예외가있는 객체는 무엇입니까? 디자이너에서 After and Before Properties를 지정 했습니까? – Redzio

관련 문제