Thursday, May 20, 2010

Get TFS Team Project Names

Here is a method that returns a List of names of team projects available at Team Foundation Server

public static List<string> GetProjects(TeamFoundationServer tfsServer)
        {
            List <string> listProjects = new List<string>();      

            ICommonStructureService iss = (ICommonStructureService)tfsServer.GetService(typeof(ICommonStructureService));           
            ProjectInfo[] projectInfo = iss.ListProjects();

            foreach (ProjectInfo pi in projectInfo)
            {
                listProjects.Add (pi.Name);
            }                                                

            return listProjects;
        }

No comments:

Post a Comment