C# TFS 2012 API以编程方式设置TeamSettings

C# TFS 2012 API以编程方式设置TeamSettings,c#,tfs,tfs-sdk,C#,Tfs,Tfs Sdk,是否可以通过编程方式设置团队设置 var teamConfig = _tfs.GetService<TeamSettingsConfigurationService>(); var css = _tfs.GetService<ICommonStructureService4>(); var configs = teamConfig.GetTeamConfigurationsForUser(new[] { _

是否可以通过编程方式设置团队设置

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;
var teamConfig=_tfs.GetService();
var css=_tfs.GetService();
var configs=teamConfig.getteamconfigurationsfourser(新[]{u selectedTeamProject.Uri});
var team=configs.Where(c=>c.TeamName==“Demo”).FirstOrDefault()作为TeamConfiguration;
上面的代码给出了团队演示的团队配置。查看TeamSettings,它包含属性BackLogiMetationPath、CurrentIterationPath、IterationPath如何以编程方式设置这些参数?


我想我自己已经解决了

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

干杯,塔伦

谢谢,这正是我需要的。现在我可以显示当前的Sprint了
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