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;
            }
        }
Ejemplo n.º 2
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));
     }
 }
Ejemplo n.º 3
0
        public TeamManager(string teamProjectCollectionUrl, string teamProjectName, string softwareProjectName, string softwareProjectDescription)
        {
            _teamProjectCollectionUrl   = teamProjectCollectionUrl;
            _teamProjectName            = teamProjectName;
            _softwareProjectName        = softwareProjectName;
            _softwareProjectDescription = softwareProjectDescription;

            _tfsTeamProjectCollection = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(new Uri(_teamProjectCollectionUrl));
            _tfsTeamProjectCollection.EnsureAuthenticated();
            _commonStructureService4          = _tfsTeamProjectCollection.GetService <ICommonStructureService4>();
            _tfsTeamService                   = _tfsTeamProjectCollection.GetService <TfsTeamService>();
            _teamSettingsConfigurationService = _tfsTeamProjectCollection.GetService <TeamSettingsConfigurationService>();
            _projectInfo = _commonStructureService4.GetProjectFromName(_teamProjectName);
        }
Ejemplo n.º 4
0
        public AreaManager(ProjectDetail projectDetail, ITfsCredentials tfsCredentials)
        {
            this.projectDetail = projectDetail;

            this.tfsTeamProjectCollection = TfsApi.Administration.TfsTeamProjectCollectionFactory.GetTeamProjectCollection(this.projectDetail.CollectionUri, tfsCredentials);

            this.teamConfig = this.tfsTeamProjectCollection.GetService <TeamSettingsConfigurationService>();

            this.commonStructureService = (ICommonStructureService4)this.tfsTeamProjectCollection.GetService(typeof(ICommonStructureService4));

            this.projectInfo = this.commonStructureService.GetProjectFromName(this.projectDetail.ProjectName);

            foreach (TeamConfiguration item in this.teamConfig.GetTeamConfigurationsForUser(new[] { this.projectInfo.Uri }))
            {
                this.teamConfiguration = item;
                break;
            }
        }
Ejemplo n.º 5
0
        public AreaManager(ProjectDetail projectDetail, ITfsCredentials tfsCredentials)
        {
            this.projectDetail = projectDetail;

            this.tfsTeamProjectCollection = TfsApi.Administration.TfsTeamProjectCollectionFactory.GetTeamProjectCollection(this.projectDetail.CollectionUri, tfsCredentials);

            this.teamConfig = this.tfsTeamProjectCollection.GetService<TeamSettingsConfigurationService>();

            this.commonStructureService = (ICommonStructureService4)this.tfsTeamProjectCollection.GetService(typeof(ICommonStructureService4));

            this.projectInfo = this.commonStructureService.GetProjectFromName(this.projectDetail.ProjectName);

            foreach (TeamConfiguration item in this.teamConfig.GetTeamConfigurationsForUser(new[] { this.projectInfo.Uri }))
            {
                this.teamConfiguration = item;
                break;
            }
        }
Ejemplo n.º 6
0
        public TeamManager(Dto.ProjectDetail projectDetail, TfsApi.Contracts.ITfsCredentials tfsCredentials)
        {
            this.tfsCredentials = tfsCredentials;

            this.projectDetail = projectDetail;

            this.tfsTeamProjectCollection = TfsApi.Administration.TfsTeamProjectCollectionFactory.GetTeamProjectCollection(this.projectDetail.CollectionUri, this.tfsCredentials);

            this.teamSettingsConfigurationService = this.tfsTeamProjectCollection.GetService<TeamSettingsConfigurationService>();

            this.commonStructureService = (ICommonStructureService4)this.tfsTeamProjectCollection.GetService(typeof(ICommonStructureService4));

            this.projectInfo = this.commonStructureService.GetProjectFromName(this.projectDetail.ProjectName);

            this.groupSecurityService = (IGroupSecurityService)this.tfsTeamProjectCollection.GetService<IGroupSecurityService>();

            this.TfsTeamService = (Microsoft.TeamFoundation.Client.TfsTeamService)this.tfsTeamProjectCollection.GetService(typeof(Microsoft.TeamFoundation.Client.TfsTeamService));
        }
Ejemplo n.º 7
0
        public TeamManager(Dto.ProjectDetail projectDetail, TfsApi.Contracts.ITfsCredentials tfsCredentials)
        {
            this.tfsCredentials = tfsCredentials;

            this.projectDetail = projectDetail;

            this.tfsTeamProjectCollection = TfsApi.Administration.TfsTeamProjectCollectionFactory.GetTeamProjectCollection(this.projectDetail.CollectionUri, this.tfsCredentials);

            this.teamSettingsConfigurationService = this.tfsTeamProjectCollection.GetService <TeamSettingsConfigurationService>();

            this.commonStructureService = (ICommonStructureService4)this.tfsTeamProjectCollection.GetService(typeof(ICommonStructureService4));

            this.projectInfo = this.commonStructureService.GetProjectFromName(this.projectDetail.ProjectName);

            this.groupSecurityService = (IGroupSecurityService)this.tfsTeamProjectCollection.GetService <IGroupSecurityService>();

            this.TfsTeamService = (Microsoft.TeamFoundation.Client.TfsTeamService) this.tfsTeamProjectCollection.GetService(typeof(Microsoft.TeamFoundation.Client.TfsTeamService));
        }
        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));
        }
Ejemplo n.º 9
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);
        }