Я пытаюсь создать / обновить рабочий элемент в devop Azure с помощью API.Я могу создать / обновить элемент, если он не имеет никакого отношения.Но если я укажу отношение, например parent-child, то получаю сообщение об ошибке ниже:
TF401349: произошла непредвиденная ошибка, проверьте ваш запрос и повторите попытку.
Я использую JsonPatchDocument для создания/ обновить рабочий элемент.Пример ниже:
class Example
{
JsonPatchOperation AddRelationship(JsonPatchDocument doc, string rel, WorkItem linkedItem, bool isNew, int index)
{
//update link
if (!isNew)
{
return new JsonPatchOperation()
{
Operation = Operation.Add,
Path = "/relations/" + index,
Value = new { rel, url = linkedItem.Url, attributes = new { comment = "comment while update" } }
};
}
else
return new JsonPatchOperation()
{
Operation = Operation.Add,
Path = "/relations/-",
Value = new { rel, url = linkedItem.Url, attributes = new { comment = "Comment while creating item" } }
};
}
void Save()
{
// some code
doc.Add(AddRelationship(doc, "System.LinkTypes.Hierarchy-Forward", item, isNew, index++));
var workItem = isNew
? witClient.CreateWorkItemAsync(doc, Vsts.Project, issueType, bypassRules: true, validateOnly: Mode == ProcessingMode.ReadOnly).Result
: witClient.UpdateWorkItemAsync(doc, existingWorkItemId.Value, bypassRules: true, validateOnly: Mode == ProcessingMode.ReadOnly).Result;
}
}
}
Спасибо.