tfs如何创建迭代并在C#中将工作项链接到它

时间:2016-08-31 09:33:42

标签: c# tfs

如何在C#中创建迭代并将工作项链接到它。在Api中有一种在C#中以编程方式创建新迭代并将任务链接到它的方法,这样我就可以在visual studio网站上查看它并在迭代下查看任务 谢谢

1 个答案:

答案 0 :(得分:1)

Use REST API to create an iteration and create a task under this iteration.

Create an iteration:

POST https://{instance}/DefaultCollection/{project}/_apis/wit/classificationnodes/iterations?api-version=1.0

        Content-Type: application/json

        {
          "name": "Final Iteration",
          "attributes": {
            "startDate": "2016-10-27T00:00:00Z",
            "finishDate": "2016-10-31T00:00:00Z"
          }

    }

Create a work item:

PATCH https://{instance}/DefaultCollection/{project}//_apis/wit/workitems/$Task?api-version=1.0

Content-Type: application/json-patch+json

[
  {
    "op": "add",
    "path": "/fields/System.Title",
    "value": "XXXX"
  },

 {
    "op": "add",
    "path": "/fields/System.IterationPath",
    "value": "XXXX\\Final Iteration"
  }
]

Then you can check the project on the codeplex: https://vsorest.codeplex.com/, which shows how to use VSO REST APIs using C#.