本文介绍了TFS 2012 API集TeamSettings编程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有可能以编程方式设置TeamSettings?

Is it possible to set the TeamSettings Programmatically?

var teamConfig = _tfs.GetService<TeamSettingsConfigurationService>();
                var css = _tfs.GetService<ICommonStructureService4>();

                var configs = teamConfig.GetTeamConfigurationsForUser(new[] { _selectedTeamProject.Uri });
                var team = configs.Where(c => c.TeamName == "Demo").FirstOrDefault() as TeamConfiguration;



上面的代码让我对球队的演示组配置。再看TeamSettings,它包含属性BacklogIterationPath,CurrentIterationPath,IterationPaths。 如何可以在这些被编程设置?

推荐答案

我想我已经解决了它自己。

I think I have solved it myself.

        // Set up default team sprint date and time
        var teamConfig = _tfs.GetService<TeamSettingsConfigurationService>();
        var css = _tfs.GetService<ICommonStructureService4>();

        string rootNodePath = string.Format("\\{0}\\Iteration\\Release 1\\Sprint 1", _selectedTeamProject.Name);
        var pathRoot = css.GetNodeFromPath(rootNodePath);

        css.SetIterationDates(pathRoot.Uri, DateTime.Now.AddDays(-5), DateTime.Now.AddDays(7));

        var configs = teamConfig.GetTeamConfigurationsForUser(new[] { _selectedTeamProject.Uri });
        var team = configs.Where(c => c.TeamName == "Demo").FirstOrDefault();

        var ts = team.TeamSettings;
        ts.BacklogIterationPath = string.Format(@"{0}\Release 1", _selectedTeamProject.Name);
        ts.IterationPaths = new string[] { string.Format(@"{0}\Release 1\Sprint 1", _selectedTeamProject.Name), string.Format(@"{0}\Release 1\Sprint 2", _selectedTeamProject.Name) };

        var tfv = new TeamFieldValue();
        tfv.IncludeChildren = true;
        tfv.Value = _selectedTeamProject.Name;
        ts.TeamFieldValues = new []{tfv};

        teamConfig.SetTeamSettings(team.TeamId, ts);

本设置,

1. Iteration Start and Finish Date for an Iteration
2. Backlog Iteration Path for the team Demo
3. Sets up Iteration Paths for the team Demo
4. Sets up the default Area Path for the team Demo

HTH
干杯,塔伦

HTHCheers, Tarun

这篇关于TFS 2012 API集TeamSettings编程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-15 11:59