TFS 11 2012 API 问题:查询容量和休息天数 [英] TFS 11 2012 API Questions : query capacity and days off

查看:18
本文介绍了TFS 11 2012 API 问题:查询容量和休息天数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要使用 TFS API 完成几件事情.其中,我必须阅读每个项目冲刺的资源规划信息,以在 WPF UI 中显示.

I need to get several things done with the TFS API. Among those, I have to read the Resource planning information for the sprints of each Project to display in a WPF UI.

标记本指南,我现在有以下方法:

Tagging along this guide, I now have the following method:

    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);
                        }
                    }
                }
            }
        }
    }

我需要打印到控制台(当然仅针对此示例)是容量视图中显示的大部分信息:

What I need to print to Console (just for this example of course) is most of the information shown in the Capacity view:

更准确地说,我需要访问

To be more precise, I need to access

  • 每日容量
  • 休息日(会员)
  • 休息日(团队)

关于如何做到这一点的任何想法?

Any ideas on how to do this?

推荐答案

这些值只能从服务器对象模型中获得(目前没有等效的客户端对象模型).接口和对象都是 Internal 所以即使在服务器上你也不能访问这些值.

These values are only available from the Server Object Model (there is no Client Object Model equivalent at the moment). The interfaces and objects are all made Internal so even on the server you can't access these values.

内部 TeamCapacity GetTeamIterationCapacity(Guid teamId, Guid iterationId);

声明类型:Microsoft.TeamFoundation.Server.WebAccess.WorkItemTracking.Common.DataAccess.TeamConfigurationComponent

程序集:Microsoft.TeamFoundation.Server.WebAccess.WorkItemTracking.Common,版本=12.0.0.0

目前获取数据的唯一方法是通过 json 服务 (/tfs/{ProjectCollection}/{Team Project}/_api/_teamcapacity/updateteamcapacity/{Team}/{Iteration/Path}?__v=4) Team Capacity 页面使用或直接来自 James Tupper 提到的表中的 ProjectCollection 数据库.

At the moment the only way to get to the data is through the json service (/tfs/{ProjectCollection}/{Team Project}/_api/_teamcapacity/updateteamcapacity/{Team}/{Iteration/Path}?__v=4) the Team Capacity page uses or directly from the ProjectCollection database from the tables mentioned by James Tupper.

看起来 json 服务正在使用请求验证,这使得它很难从任何外部系统使用.

It looks like the json service is using Request Verification which makes it hard to use from any external system.

TFS 的服务器数据库不是为了可扩展性,不支持对它们的任何直接查询,并且模型可以在不通知的情况下更改,即使在服务包之间也是如此.不支持直接查询 TFS 数据库.通过官方 API 以外的任何其他方式更改 TFS 数据库中的值实际上会使您的 TFS 服务器处于不受支持的状态,并可能在以后升级到较新版本时导致重大问题.

Required Disclaimer:

The server databases of TFS are not meant for extensibility, any direct queries against them are not supported and the model can change without notice, even between service packs. Querying the TFS databases directly is not supported. Changing the values in the TFS databases through any other means than the official API's will essentially put your TFS server in an unsupported state and can cause major issues when upgrading to a newer version later on.

这篇关于TFS 11 2012 API 问题:查询容量和休息天数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆