VSTS:使用Rest API将任务作为子项链接到方案

时间:2017-02-02 07:47:13

标签: c# json azure-devops-rest-api

我使用Rest API在VSTS中创建了方案和任务。现在我尝试使用Rest API将任务链接到该特定方案。我已经看到了一些使用System.LinkTypes.Hierarchy-Forward的代码逻辑,但我不确定如何在我的代码中容纳它。有人可以帮我吗?

我使用JsonPatchDocument方法创建了任务和方案。

1 个答案:

答案 0 :(得分:1)

刚刚找到问题的答案:

                document.Add(
                new JsonPatchOperation()
                {
                    Path = "/relations/-",
                    Operation = Microsoft.VisualStudio.Services.WebApi.Patch.Operation.Add,
                    Value = new
                    {
                        rel = "System.LinkTypes.Hierarchy-Reverse",
                        url = collectionUri + "/_apis/wit/workItems/" + porWorkItemID.ToString(),
                        attributes = new
                        {
                            comment = "Making a new link for the dependency"
                        }
                    }
                    });
相关问题