我需要使用 TFS API 完成几件事。其中,我必须阅读要在 WPF UI 中显示的每个项目的 sprint 的资源规划信息。
沿着本指南标记,我现在有以下方法:
private TfsTeamService _teamService;
private ICommonStructureService4 _structureService;
TeamSettingsConfigurationService _teamSettingsConfigurationService;
public void GetUserIterationAssignments(IList<ProjectInfo> projects)
{
foreach (ProjectInfo project in projects)
{
Console.WriteLine(project.Name);
TeamFoundationTeam team = _teamService.QueryTeams(project.Uri).First();
IList<Guid> teamGuids = new List<Guid>() { team.Identity.TeamFoundationId };
TeamConfiguration config = _teamSettingsConfigurationService.GetTeamConfigurations(teamGuids).FirstOrDefault();
if (config != null)
{
foreach (string nodePath in config.TeamSettings.IterationPaths)
{
var projectNameIndex = nodePath.IndexOf("\\", 2);
var fullPath = nodePath.Insert(projectNameIndex, "\\Iteration");
var nodeInfo = _structureService.GetNodeFromPath(fullPath);
if (nodeInfo.StartDate != null &&
nodeInfo.FinishDate != null)
{
foreach (TeamFoundationIdentity member in team.GetMembers(_collection, MembershipQuery.Direct))
{
Console.WriteLine("{0} is in assigned to {1} from {2}",
member.DisplayName,
nodeInfo.Name,
nodeInfo.StartDate,
nodeInfo.FinishDate);
}
}
}
}
}
}
我需要打印到控制台(当然只是为了这个例子)是容量视图中显示的大部分信息:
更准确地说,我需要访问
- 日容量
- 休息日(会员)
- 休息日(团队)
关于如何做到这一点的任何想法?