gpt4 book ai didi

visual-studio-2010 - Visual Studio 2010/SharePoint 2010 工作流错误

转载 作者:行者123 更新时间:2023-12-04 05:23:16 24 4
gpt4 key购买 nike

我在 VS 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 文件夹中的日志文件中没有发现任何错误...

我感谢任何帮助!谢谢!

最佳答案

我在 Visual Studio 和工作流方面遇到的问题很少,其中大部分是由于没有分配正确的任务 id 或忘记为任务更改后的属性或相关 token 或其他小事情创建。

所以你面临的问题似乎属于这一类,而不是背后的代码有问题。

尝试使用本指南并确保完成每一步:http://dotnetadil.wordpress.com/2012/05/29/sharepoint-foundation-2010-visual-studio-approval-workflow/

或者甚至更好的 Microsoft 分步指南:

http://msdn.microsoft.com/en-us/library/hh824675.aspx

我会尝试的另一件事是创建您的工作流程并确保退出条件设置为 true,以便您可以检查结构是否正确完成

关于visual-studio-2010 - Visual Studio 2010/SharePoint 2010 工作流错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13486518/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com