TFS 2012 API Set TeamSettings Programmatically

Can I programmatically configure TeamSettings?

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; 

The above code gives me Team Configuration for the Demo team. Look at TeamSettings, it contains the property BacklogIterationPath, CurrentIterationPath, IterationPaths. How can they be installed programmatically?

enter image description here

+4
source share
1 answer

I think I decided 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); 

It sets

 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 

NTN Greetings, Tarun

+4
source

Source: https://habr.com/ru/post/1439250/


All Articles