gpt4 book ai didi

c# - 添加具有优先级的TFS任务,分配给使用c#

转载 作者:行者123 更新时间:2023-11-30 20:32:32 25 4
gpt4 key购买 nike

我正在尝试使用 C# 代码创建一个 tfs 任务。我可以使用以下代码添加任务。但我无法通过此添加分配给、关键字、优先级等。我在 workItemType 对象中没有找到相关属性。

我试过 Fields["Keywords"] 等,但它对我不起作用。任何指针请

private static readonly Uri TfsServer = new Uri("my tfs url");
static readonly TfsTeamProjectCollection tpc = new TfsTeamProjectCollection(TfsServer);
static readonly WorkItemStore workItemStore = tpc.GetService<WorkItemStore>();
static readonly Project teamProject = workItemStore.Projects["my project name"];
static readonly WorkItemType workItemType = teamProject.WorkItemTypes["Task"];

WorkItem tfsTask = new WorkItem(workItemType)
{
Title = "Test Title",
//assignedto,
State = "Proposed",
//substatus ="Not Started",
AreaPath = @"my path",
IterationPath = @"my iteration path",
//Keywords ="my keyword",
//prioity=3

Description = "newVcDescription"
};

tfsTask.Save();

最佳答案

当您从 new WorkItem(workitemType){} 设置工作项字段的值时,您只能设置智能感知提供的这些字段的值: enter image description here

对于其他字段,您可以这样设置值:

tfsTask.Fields["Priority"].Value = "4";
tfsTask.Fields["Assigned To"].Value = "XXX";
tfsTask.Tags = "tag1;tag2";
tfsTask.Save();

关于c# - 添加具有优先级的TFS任务,分配给使用c#,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41269972/

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