使用tfs客户端库获取团队+用户容量/休假

时间:2018-05-07 14:00:24

标签: c# asp.net-core tfs azure-devops

我正在寻找一种方法来获得使用c#tfs客户端库的团队和用户的工作能力和休息时间。我找不到任何关于此的文档!

但我可能一直在找错地方。

1 个答案:

答案 0 :(得分:1)

请参阅下面的代码段:

            String collectionUri = "http://TFS2017:8080/tfs/defaultcollection";
            VssCredentials creds = new VssClientCredentials();
            creds.Storage = new VssClientCredentialStorage();
            VssConnection connection = new VssConnection(new Uri(collectionUri), creds);
            var whc = connection.GetClient<WorkHttpClient>();
            var capacity = whc.GetCapacitiesAsync(new Microsoft.TeamFoundation.Core.WebApi.Types.TeamContext("Teamproject"), new Guid("Iterationid")).Result;
            var daysoff = whc.GetTeamDaysOffAsync(new Microsoft.TeamFoundation.Core.WebApi.Types.TeamContext("Teamproject"), new Guid("Iterationid")).Result;