Exemple #1
0
        /// <summary>
        ///     Deletes the team project.
        /// </summary>
        /// <param name="teamProjectName">Name of the team project.</param>
        /// <param name="force">Force project deletion.</param>
        /// <param name="exceptions">The exceptions.</param>
        /// <param name="excludeWss">Specifies to not delete the SharePoint site that is associated with the team project. Specify this option to maintain the existing site so that other team projects can continue using it.</param>
        /// <exception cref="System.ArgumentException">
        ///     No team project name was specified;teamProjectName
        ///     or
        ///     The project name ( + teamProjectName + ) doesn't exists.;teamProjectName
        /// </exception>
        public bool DeleteTeamProject(string teamProjectName, out List <Exception> exceptions, bool force = false, bool excludeWss = true)
        {
            if (string.IsNullOrEmpty(teamProjectName))
            {
                throw new ArgumentException("No team project name was specified", "teamProjectName");
            }
            else
            {
                bool foundProjectName = false;
                foreach (string projectname in this.ListTeamProjectNames())
                {
                    if (string.Compare(projectname, teamProjectName, true) == 0)
                    {
                        foundProjectName = true;
                        break;
                    }
                }

                if (!foundProjectName)
                {
                    throw new ArgumentException("The project name (" + teamProjectName + ") doesn't exists.", "teamProjectName");
                }
            }

            Microsoft.TeamFoundation.Client.TeamProjectDeleter teamProjectDeleter = new TeamProjectDeleter(this._tfsTeamProjectCollection, teamProjectName, force);
            teamProjectDeleter.ExcludeWss = excludeWss;
            teamProjectDeleter.Delete();
            exceptions = teamProjectDeleter.IssuesDeletingProject;
            return(teamProjectDeleter.IssuesDeletingProject == null || teamProjectDeleter.IssuesDeletingProject.Count == 0);
        }
Exemple #2
0
        /// <summary>
        ///     Deletes the team project.
        /// </summary>
        /// <param name="teamProjectName">Name of the team project.</param>
        /// <param name="force">Force project deletion.</param>
        /// <param name="exceptions">The exceptions.</param>
        /// <param name="excludeWss">Specifies to not delete the SharePoint site that is associated with the team project. Specify this option to maintain the existing site so that other team projects can continue using it.</param>
        /// <exception cref="System.ArgumentException">
        ///     No team project name was specified;teamProjectName
        ///     or
        ///     The project name ( + teamProjectName + ) doesn't exists.;teamProjectName
        /// </exception>
        public bool DeleteTeamProject(string teamProjectName, out List<Exception> exceptions, bool force = false, bool excludeWss = true)
        {
            if (string.IsNullOrEmpty(teamProjectName))
            {
                throw new ArgumentException("No team project name was specified", "teamProjectName");
            }
            else
            {
                bool foundProjectName = false;
                foreach (string projectname in this.ListTeamProjectNames())
                {
                    if (string.Compare(projectname, teamProjectName, true) == 0)
                    {
                        foundProjectName = true;
                        break;
                    }
                }

                if (!foundProjectName)
                {
                    throw new ArgumentException("The project name (" + teamProjectName + ") doesn't exists.", "teamProjectName");
                }
            }

            Microsoft.TeamFoundation.Client.TeamProjectDeleter teamProjectDeleter = new TeamProjectDeleter(this._tfsTeamProjectCollection, teamProjectName, force);
            teamProjectDeleter.ExcludeWss = excludeWss;
            teamProjectDeleter.Delete();
            exceptions = teamProjectDeleter.IssuesDeletingProject;
            return teamProjectDeleter.IssuesDeletingProject == null || teamProjectDeleter.IssuesDeletingProject.Count == 0;
        }