使用Microsoft.VisualStudio.Services.Client如何在项目中列出所有可用的迭代?
我可以愉快地连接到我的VSO实例,但我不知道从那里去哪里。
VssConnection connection = new VssConnection(_collectionUri, _credentials);
ProjectHttpClient projClient = connection.GetClientAsync<ProjectHttpClient>().Result;
答案 0 :(得分:2)
请参阅此代码以获取迭代:
var connection = new VssConnection(u, c);
var workItemTracking = connection.GetClient<WorkItemTrackingHttpClient>();
Microsoft.TeamFoundation.Core.WebApi.ProjectHttpClient projClient = connection.GetClientAsync<Microsoft.TeamFoundation.Core.WebApi.ProjectHttpClient>().Result;
var projects= projClient.GetProjects().Result;
foreach(var p in projects)
{
var iteration = workItemTracking.GetClassificationNodeAsync(project: p.Name, structureGroup: Microsoft.TeamFoundation.WorkItemTracking.WebApi.Models.TreeStructureGroup.Iterations, depth: 5).Result;
GetIterations(iteration);
}
static void GetIterations(Microsoft.TeamFoundation.WorkItemTracking.WebApi.Models.WorkItemClassificationNode currentIteration)
{
Console.WriteLine(currentIteration.Name);
if(currentIteration.Children!=null)
{
foreach (var ci in currentIteration.Children)
{
GetIterations(ci);
}
}
}