我在VS 2010中創建了一個簡單的工作流程。它爲人員創建任務,當人員將任務狀態更改爲「完成」時,它將消息記錄到工作流程歷史。Visual Studio 2010/SharePoint 2010工作流程錯誤
當我將狀態更改爲完成時,它會顯示:「xxxx(工作流名稱)發生錯誤」。
代碼:
using System;
using System.ComponentModel;
using System.ComponentModel.Design;
using System.Collections;
using System.Drawing;
using System.Linq;
using System.Workflow.ComponentModel.Compiler;
using System.Workflow.ComponentModel.Serialization;
using System.Workflow.ComponentModel;
using System.Workflow.ComponentModel.Design;
using System.Workflow.Runtime;
using System.Workflow.Activities;
using System.Workflow.Activities.Rules;
using Microsoft.SharePoint;
using Microsoft.SharePoint.Workflow;
using Microsoft.SharePoint.WorkflowActions;
namespace WorkflowProject2.Workflow1
{
public sealed partial class Workflow1 : SequentialWorkflowActivity
{
public Workflow1()
{
InitializeComponent();
}
public Guid workflowId = default(System.Guid);
public SPWorkflowActivationProperties workflowProperties = new SPWorkflowActivationProperties();
private void onWorkflowActived(object sender, ExternalDataEventArgs e)
{
}
public Guid taskID = default(System.Guid);
public SPWorkflowTaskProperties taskProperties = new Microsoft.SharePoint.Workflow.SPWorkflowTaskProperties();
private bool taskHasCompleted = false;
public SPWorkflowTaskProperties taskAfterProperties = new Microsoft.SharePoint.Workflow.SPWorkflowTaskProperties();
public SPWorkflowTaskProperties taskBeforeProperties = new Microsoft.SharePoint.Workflow.SPWorkflowTaskProperties();
public String taskOutcome = default(System.String);
public Guid TaskStatusFieldID = new Guid("c15b34c3-ce7d-490a-b133-3f4de8801b76");
private void createTask1_MethodInvoking(object sender, EventArgs e)
{
taskID = Guid.NewGuid();
taskProperties.AssignedTo = "spdev\\lzhang";
taskProperties.Description = "Please review";
taskProperties.Title = "Leave application";
}
private void completeTask1_MethodInvoking(object sender, EventArgs e)
{
// Finalize the task:
taskAfterProperties.PercentComplete = 100;
taskOutcome = "Completed";
}
private void notComplete(object sender, ConditionalEventArgs e)
{
e.Result = !taskHasCompleted; // **(A)**
}
private void onTaskChanged1_Invoked(object sender, ExternalDataEventArgs e)
{
string taskStatus = taskAfterProperties.ExtendedProperties[TaskStatusFieldID].ToString();
if (taskStatus == "Completed")
{
taskHasCompleted = true; // **(B)**
}
}
}
}
我有一種感覺,必須有一些問題(A)或(B),但我不知道如何解決它。我在14/LOGS文件夾的日誌文件中沒有發現任何錯誤...
我感謝任何幫助!謝謝!
感謝您的答覆!我會查看鏈接,看看能否找到任何東西......關心,Lin –