public void IncludeAllAreas()
        {
            try
            {
                TfsTeamProjectCollection tpc = TfsConnect();

                ICommonStructureService4 css = tpc.GetService <ICommonStructureService4>();
                ProjectInfo project          = css.GetProjectFromName(TeamProject);
                TeamSettingsConfigurationService teamConfigService = tpc.GetService <TeamSettingsConfigurationService>();
                var teamConfigs = teamConfigService.GetTeamConfigurationsForUser(new string[] { project.Uri });
                foreach (TeamConfiguration teamConfig in teamConfigs)
                {
                    if (teamConfig.IsDefaultTeam)
                    {
                        TeamSettings settings = teamConfig.TeamSettings;
                        foreach (TeamFieldValue tfv in settings.TeamFieldValues)
                        {
                            tfv.IncludeChildren = true;
                            teamConfigService.SetTeamSettings(teamConfig.TeamId, settings);
                        }
                    }
                }
                Console.WriteLine();
            }
            catch (Exception ex)
            {
                Console.WriteLine("Error: " + ex.Message);
                throw;
            }
        }
Пример #2
0
        private Dictionary <TeamProjectReference, List <TeamConfiguration> > GetProjectsWithSettings(ProjectHttpClient css,
                                                                                                     TeamSettingsConfigurationService team)
        {
            var result = new Dictionary <TeamProjectReference, List <TeamConfiguration> >();

            var projects = css.GetProjects(null).Result;

            foreach (var project in projects)
            {
                try
                {
                    var settings = team
                                   .GetTeamConfigurationsForUser(new[] { project.Url })
                                   .ToList();

                    if (!settings.IsNullOrEmpty())
                    {
                        result[project] = settings;
                    }
                }
                catch
                {
                }
            }

            return(result);
        }
Пример #3
0
 public TeamModel GetTeam(Guid collectionId, int projectId)
 {
     using (var server = GetServer())
     {
         TfsTeamProjectCollection collection = server.GetTeamProjectCollection(collectionId);
         WorkItemStore            wiStore    = collection.GetService <WorkItemStore>();
         Project project = wiStore.Projects.GetById(projectId);
         TeamSettingsConfigurationService configurationService = collection.GetService <TeamSettingsConfigurationService>();
         TeamConfiguration config = configurationService.GetTeamConfigurationsForUser(new[] { project.Uri.ToString() }).FirstOrDefault();
         //TODO config can be null
         return(Map(config));
     }
 }
Пример #4
0
        public UserControl CreateUserControl(IEnumerable <IReport> supportedReports, IEnumerable <IReport> allReports)
        {
            uc = new TfsUserControl(supportedReports, allReports);
            foreach (var teamConfiguration in teamConfig.GetTeamConfigurationsForUser(new[] { projInfo.Uri }))
            {
                uc.Teams.Add(teamConfiguration);
                if (teamConfiguration.IsDefaultTeam)
                {
                    uc.SelectedTeam          = teamConfiguration;
                    uc.SelectedIterationPath = teamConfiguration.TeamSettings.CurrentIterationPath;
                }
            }
            uc.workItemStoreService = workItemStoreService;

            return(uc);
        }
Пример #5
0
        public List <ITfsTeam> ListTeams(bool ignoreCache = true)
        {
            if (!ignoreCache)
            {
                return(_localTfsTeamCache);
            }
            else
            {
                List <ITfsTeam> result = new List <ITfsTeam>();

                foreach (TeamConfiguration teamConfiguration in teamSettingsConfigurationService.GetTeamConfigurationsForUser(new[] { projectInfo.Uri }))
                {
                    ITfsTeam team = CreateTfsTeamFromTeamConfiguration(teamConfiguration);
                    result.Add(team);
                }
                _localTfsTeamCache = result;
                return(result);
            }
        }
        public void SetPlanningIterations()
        {
            TfsTeamProjectCollection tpc = TfsConnect();
            ICommonStructureService4 css = tpc.GetService <ICommonStructureService4>();
            ProjectInfo project          = css.GetProjectFromName(TeamProject);
            TeamSettingsConfigurationService teamConfigService = tpc.GetService <TeamSettingsConfigurationService>();
            var teamConfigs = teamConfigService.GetTeamConfigurationsForUser(new string[] { project.Uri });

            foreach (TeamConfiguration teamConfig in teamConfigs)
            {
                if (teamConfig.IsDefaultTeam)
                {
                    TeamSettings settings = teamConfig.TeamSettings;
                    settings.IterationPaths = PlanningSprints.ToArray();
                    teamConfigService.SetTeamSettings(teamConfig.TeamId, settings);
                    Console.Write(new string('.', PlanningSprints.Count));
                }
            }
            Console.WriteLine(string.Format(" ({0} iterations)", PlanningSprints.Count));
        }