VSTS使用WorkItemClassificationNode创建区域路径

时间:2016-01-15 08:09:32

标签: azure-devops

我正在使用VSTS .NET客户端库,而我正在尝试创建区域路径。我已经有了WorkItemTrackingHttpClient。在此客户端上,我可以使用CreateOrUpdateClassificationNodeAsync方法创建区域路径。但是我无法设置区域路径的父级。

        var node = new WorkItemClassificationNode();
        node.StructureType = TreeNodeStructureType.Area;
        node.Name = "Test";
        var result = await this.Client.CreateOrUpdateClassificationNodeAsync(node, "Team-Project", TreeStructureGroup.Areas);

如何设置区域路径的父级?

2 个答案:

答案 0 :(得分:7)

你几乎做对了。要在特定路径创建区域,请使用以下代码:

var node = new WorkItemClassificationNode();
node.StructureType = TreeNodeStructureType.Area;
node.Name = “Name”;
var result = this.Client.CreateOrUpdateClassificationNodeAsync(
         node,
         "Project",
          TreeStructureGroup.Areas,
          "Path/to/parent/node/");

重要参数是指定新节点父节点的路径。

答案 1 :(得分:1)

Shai在TFS SDK上有一组创建文章。本文介绍了如何与分类节点进行交互:http://blogs.microsoft.co.il/shair/2009/01/30/tfs-api-part-10-add-areaiteration-programmatically/