我正在尝试在中创建任务VSTS
,但出现以下错误。
TF401320:字段任务类型的规则错误。错误代码:必需、HasValues、LimitedToValues、AllowsOldValue、InvalidEmpty。
很Exception
明显,我缺少一个必填字段,即Task Type
. 现在我无法找到Task Type
. 谁能帮我这个。
下面是我正在编写的添加任务的代码:
string discipline = "Research Task";
if (taskDesc.Key.Contains("Configuration"))
{
discipline = "Dev Task";
}
if (taskDesc.Key.Contains("Validation"))
{
discipline = "Quality Task";
}
var workitemtype = "Task";
var document = new JsonPatchDocument();
document.Add(
new JsonPatchOperation()
{
Path = "/fields/Microsoft.VSTS.Common.Discipline",
Operation = Microsoft.VisualStudio.Services.WebApi.Patch.Operation.Add,
Value = discipline
});
document.Add(
new JsonPatchOperation()
{
Path = "/fields/System.Title",
Operation = Microsoft.VisualStudio.Services.WebApi.Patch.Operation.Add,
Value = string.Format("{0} {1}", porIDText, taskDesc.Key)
});
document.Add(new JsonPatchOperation()
{
Path = "/fields/System.AreaPath",
Operation = Microsoft.VisualStudio.Services.WebApi.Patch.Operation.Add,
Value = System.Configuration.ConfigurationManager.AppSettings["AreaPath"]
});
document.Add(
new JsonPatchOperation()
{
Path = "/fields/System.AssignedTo",
Operation = Microsoft.VisualStudio.Services.WebApi.Patch.Operation.Add,
Value = "<name>"
});
document.Add(
new JsonPatchOperation()
{
Path = "/fields/System.Description",
Operation = Microsoft.VisualStudio.Services.WebApi.Patch.Operation.Add,
Value = taskDesc.Value
});
var wi = client.CreateWorkItemAsync(
document,
teamProjectName,
workitemtype).Result;