public WebApiTeam CreateTeam()
        {
            // Find a project to create the team in
            TeamProjectReference project = ClientSampleHelpers.FindAnyProject(this.Context);

            string teamName        = "Sample team " + Guid.NewGuid();
            string teamDescription = "Short description of my new team";

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

            // Construct team parameters object
            WebApiTeam newTeamCreateParameters = new WebApiTeam()
            {
                Name        = teamName,
                Description = teamDescription
            };

            WebApiTeam newTeam = teamClient.CreateTeamAsync(newTeamCreateParameters, project.Id.ToString()).Result;

            Console.WriteLine("Team created: '{0}' (ID: {1})", newTeam.Name, newTeam.Id);

            // Save the team for use later in the rename/delete samples
            this.Context.SetValue <WebApiTeamRef>("$newTeam", newTeam);
            this.Context.SetValue <TeamProjectReference>("$projectOfNewTeam", project);

            return(newTeam);
        }
示例#2
0
        public WebApiTeam CreateTeam(string project, WebApiTeam teamData)
        {
            VssConnection  connection     = new VssConnection(_uri, _credentials);
            TeamHttpClient teamHttpClient = connection.GetClient <TeamHttpClient>();
            WebApiTeam     result         = teamHttpClient.CreateTeamAsync(teamData, project).Result;

            return(result);
        }
示例#3
0
 public WebApiTeam CreateTeam(string project, WebApiTeam teamData)
 {
     // create team object
     using (TeamHttpClient teamHttpClient = new TeamHttpClient(_uri, _credentials))
     {
         WebApiTeam result = teamHttpClient.CreateTeamAsync(teamData, project).Result;
         return(result);
     }
 }
示例#4
0
        /// <summary>
        /// Create a new team
        /// </summary>
        /// <param name="TeamProjectName"></param>
        /// <param name="TeamName"></param>
        static void CreateNewTeam(string TeamProjectName, string TeamName)
        {
            WebApiTeam newTeam = new WebApiTeam();

            newTeam.Name        = TeamName;
            newTeam.Description = "Created from a command line";

            newTeam = TeamClient.CreateTeamAsync(newTeam, TeamProjectName).Result;

            Console.WriteLine("The new team '{0}' has been created in the team project '{1}'", newTeam.Name, newTeam.ProjectName);
        }
示例#5
0
        public WebApiTeam CreateTeam()
        {
            WebApiTeam teamData = new WebApiTeam()
            {
                Name = "My new team"
            };

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

            return(result);
        }
        public WebApiTeam CreateTeam()
        {
            string project = _configuration.Project;

            WebApiTeam teamData = new WebApiTeam()
            {
                Name = "My new team"
            };

            // create team object
            using (TeamHttpClient teamHttpClient = new TeamHttpClient(_uri, _credentials))
            {
                WebApiTeam result = teamHttpClient.CreateTeamAsync(teamData, project).Result;
                return(result);
            }
        }
示例#7
0
        /// <summary>
        /// Creates a new team using the <paramref name="teamToCreate" /> as template in the project corresponding to the <paramref name="projectNameOrId" />.
        /// </summary>
        /// <param name="teamHttpClient">The team HTTP client.</param>
        /// <param name="teamToCreate">The team to create.</param>
        /// <param name="projectNameOrId">The project name or identifier.</param>
        /// <param name="userState">The user state object to pass along to the underlying method.</param>
        /// <returns>
        /// The created team.
        /// </returns>
        /// <exception cref="ArgumentNullException">teamHttpClient</exception>
        public static IObservable <WebApiTeam> CreateTeam(
            this TeamHttpClient teamHttpClient, WebApiTeam teamToCreate, string projectNameOrId, object userState = null)
        {
            if (teamHttpClient == null)
            {
                throw new ArgumentNullException(nameof(teamHttpClient));
            }
            if (teamToCreate == null)
            {
                throw new ArgumentNullException(nameof(teamToCreate));
            }

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

            return(Observable.FromAsync(cancellationToken => teamHttpClient.CreateTeamAsync(teamToCreate, projectNameOrId, userState, cancellationToken)));
        }
 public async Task <WebApiTeam> CreateTeamAsync(WebApiTeam team, Guid projectId)
 {
     return(await teamClient.CreateTeamAsync(team, projectId.ToString()));
 }