Пример #1
0
        private static void UpdateTeamSettings(string TeamProjectName, string TeamName)
        {
            Console.WriteLine("==========Update Settings");

            TeamContext teamContext = new TeamContext(TeamProjectName, TeamName);

            TeamSetting teamSetting = WorkClient.GetTeamSettingsAsync(teamContext).Result;

            TeamSettingsPatch teamSettingsPatch = new TeamSettingsPatch();

            //update backlogs

            teamSettingsPatch.BacklogVisibilities = teamSetting.BacklogVisibilities;

            if (teamSettingsPatch.BacklogVisibilities.ContainsKey(BacklogCategories.Epic) && teamSettingsPatch.BacklogVisibilities[BacklogCategories.Epic])
            {
                teamSettingsPatch.BacklogVisibilities[BacklogCategories.Epic] = false;
            }
            if (teamSettingsPatch.BacklogVisibilities.ContainsKey(BacklogCategories.Feature) && teamSettingsPatch.BacklogVisibilities[BacklogCategories.Feature])
            {
                teamSettingsPatch.BacklogVisibilities[BacklogCategories.Feature] = false;
            }

            //more work
            teamSettingsPatch.WorkingDays = new DayOfWeek[] { DayOfWeek.Monday, DayOfWeek.Tuesday, DayOfWeek.Wednesday, DayOfWeek.Thursday, DayOfWeek.Friday, DayOfWeek.Saturday };

            teamSetting = WorkClient.UpdateTeamSettingsAsync(teamSettingsPatch, teamContext).Result;

            GetTeamSettings(TeamProjectName, TeamName);
        }
Пример #2
0
        public TeamSetting UpdateTeamSettings()
        {
            IDictionary <string, bool> backlogVisibilities = new Dictionary <string, bool>()
            {
                { "Microsoft.EpicCategory", false },
                { "Microsoft.FeatureCategory", true },
                { "Microsoft.RequirementCategory", true }
            };

            TeamSettingsPatch updatedTeamSettings = new TeamSettingsPatch()
            {
                BugsBehavior        = BugsBehavior.AsTasks,
                WorkingDays         = new DayOfWeek[] { DayOfWeek.Monday, DayOfWeek.Tuesday, DayOfWeek.Wednesday },
                BacklogVisibilities = backlogVisibilities
            };

            VssConnection  connection = Context.Connection;
            WorkHttpClient workClient = connection.GetClient <WorkHttpClient>();

            Guid projectId = ClientSampleHelpers.FindAnyProject(this.Context).Id;
            var  context   = new TeamContext(projectId);

            TeamSetting result = workClient.UpdateTeamSettingsAsync(updatedTeamSettings, context).Result;

            Console.WriteLine("Backlog iteration: {0}", result.BacklogIteration.Name);
            Console.WriteLine("Bugs behavior: {0}", result.BugsBehavior);
            Console.WriteLine("Default iteration : {0}", result.DefaultIterationMacro);
            Console.WriteLine("Working days: {0}", String.Join(",", result.WorkingDays.Select <DayOfWeek, string>(dow => { return(dow.ToString()); })));

            return(result);
        }
Пример #3
0
        public TeamSetting UpdateTeamSettings(string project)
        {
            IDictionary <string, bool> backlogVisibilities = new Dictionary <string, bool>()
            {
                { "Microsoft.EpicCategory", false },
                { "Microsoft.FeatureCategory", true },
                { "Microsoft.RequirementCategory", true }
            };

            TeamSettingsPatch patchDocument = new TeamSettingsPatch()
            {
                BugsBehavior        = BugsBehavior.AsRequirements,
                WorkingDays         = new DayOfWeek[] { DayOfWeek.Monday, DayOfWeek.Tuesday, DayOfWeek.Wednesday, DayOfWeek.Thursday },
                BacklogVisibilities = backlogVisibilities
            };

            VssConnection  connection     = new VssConnection(_uri, _credentials);
            WorkHttpClient workHttpClient = connection.GetClient <WorkHttpClient>();
            var            teamContext    = new TeamContext(project);
            TeamSetting    result         = workHttpClient.UpdateTeamSettingsAsync(patchDocument, teamContext).Result;

            return(result);
        }