public WebApiTeam RenameTeam()
        {
            // Use the previously created team (from the sample above)
            WebApiTeamRef        team;
            TeamProjectReference project = ClientSampleHelpers.FindAnyProject(this.Context);

            if (!this.Context.TryGetValue <WebApiTeamRef>("$newTeam", out team) || !this.Context.TryGetValue <TeamProjectReference>("$projectOfNewTeam", out project))
            {
                throw new Exception("Run the create team sample above first.");
            }

            //Get a client
            VssConnection  connection = Context.Connection;
            TeamHttpClient teamClient = connection.GetClient <TeamHttpClient>();

            WebApiTeam teamUpdateParameters = new WebApiTeam()
            {
                Name = team.Name + " (renamed)"
            };

            WebApiTeam updatedTeam = teamClient.UpdateTeamAsync(teamUpdateParameters, project.Id.ToString(), team.Id.ToString()).Result;

            Console.WriteLine("Team renamed from '{0}' to '{1}'", team.Name, updatedTeam.Name);

            return(updatedTeam);
        }
Beispiel #2
0
        public WebApiTeam UpdateTeam(string project, string team, WebApiTeam teamData)
        {
            VssConnection  connection     = new VssConnection(_uri, _credentials);
            TeamHttpClient teamHttpClient = connection.GetClient <TeamHttpClient>();
            WebApiTeam     result         = teamHttpClient.UpdateTeamAsync(teamData, project, team).Result;

            return(result);
        }
Beispiel #3
0
 public WebApiTeam UpdateTeam(string project, string team, WebApiTeam teamData)
 {
     // create team object
     using (TeamHttpClient teamHttpClient = new TeamHttpClient(_uri, _credentials))
     {
         WebApiTeam result = teamHttpClient.UpdateTeamAsync(teamData, project, team).Result;
         return(result);
     }
 }
Beispiel #4
0
        // <summary>
        /// Update an existing team
        /// </summary>
        /// <param name="TeamProjectName"></param>
        /// <param name="TeamName"></param>
        static void UpdateTeam(string TeamProjectName, string TeamName)
        {
            WebApiTeam team = TeamClient.GetTeamAsync(TeamProjectName, TeamName).Result;

            WebApiTeam updatedTeam = new WebApiTeam {
                Name        = team.Name + " updated",
                Description = team.Description.Replace("Created", "Updated")
            };

            updatedTeam = TeamClient.UpdateTeamAsync(updatedTeam, team.ProjectName, team.Name).Result;

            Console.WriteLine("The team '{0}' has been updated in the team project '{1}'", updatedTeam.Name, updatedTeam.ProjectName);
        }
Beispiel #5
0
        public WebApiTeam UpdateTeam()
        {
            string teamName = "My new team";

            WebApiTeam teamData = new WebApiTeam()
            {
                Description = "my awesome team description"
            };

            VssConnection  connection     = new VssConnection(_uri, _credentials);
            TeamHttpClient teamHttpClient = connection.GetClient <TeamHttpClient>();
            WebApiTeam     result         = teamHttpClient.UpdateTeamAsync(teamData, _configuration.Project, teamName).Result;

            return(result);
        }
        public WebApiTeam UpdateTeam()
        {
            string project = _configuration.Project;
            string team    = "My new team";

            WebApiTeam teamData = new WebApiTeam()
            {
                Description = "my awesome team description"
            };

            // create team object
            using (TeamHttpClient teamHttpClient = new TeamHttpClient(_uri, _credentials))
            {
                WebApiTeam result = teamHttpClient.UpdateTeamAsync(teamData, project, team).Result;
                return(result);
            }
        }
Beispiel #7
0
        /// <summary>
        /// Updates an existing team for the <paramref name="teamNameOrId" /> using the <paramref name="updatedTeam" /> as template in the project corresponding to the <paramref name="projectNameOrId" />.
        /// </summary>
        /// <param name="teamHttpClient">The team HTTP client.</param>
        /// <param name="updatedTeam">The updated team.</param>
        /// <param name="projectNameOrId">The project name or identifier.</param>
        /// <param name="teamNameOrId">The team name or identifier.</param>
        /// <param name="userState">The user state object to pass along to the underlying method.</param>
        /// <returns>
        /// The updated team.
        /// </returns>
        /// <exception cref="ArgumentNullException">teamHttpClient</exception>
        public static IObservable <WebApiTeam> UpdateTeam(
            this TeamHttpClient teamHttpClient, WebApiTeam updatedTeam, string projectNameOrId, string teamNameOrId, object userState = null)
        {
            if (teamHttpClient == null)
            {
                throw new ArgumentNullException(nameof(teamHttpClient));
            }
            if (updatedTeam == null)
            {
                throw new ArgumentNullException(nameof(updatedTeam));
            }

            if (string.IsNullOrWhiteSpace(projectNameOrId))
            {
                throw new ArgumentOutOfRangeException(nameof(projectNameOrId), $"'{nameof(projectNameOrId)}' may not be null or empty or whitespaces only");
            }
            if (string.IsNullOrWhiteSpace(teamNameOrId))
            {
                throw new ArgumentOutOfRangeException(nameof(teamNameOrId), $"'{nameof(teamNameOrId)}' may not be null or empty or whitespaces only");
            }

            return(Observable.FromAsync(cancellationToken => teamHttpClient.UpdateTeamAsync(updatedTeam, projectNameOrId, teamNameOrId, userState, cancellationToken)));
        }