Пример #1
0
        public IEnumerable<Node> GetTfsProjects(TfsConnection conn)
        {
            var cols = new List<Node>();
            var configServer = new TfsConfigurationServer(
                new Uri(conn.TfsUrl),
                new NetworkCredential(conn.Username, conn.Password, conn.Domain));
            configServer.Authenticate();

            var catalog = configServer.CatalogNode;
            var tpcNodes = catalog.QueryChildren(
                new Guid[] { CatalogResourceTypes.ProjectCollection },
                false, CatalogQueryOptions.None);

            foreach (var tpcNode in tpcNodes)
            {
                Node nd = new Node();

                Guid tpcId = new Guid(tpcNode.Resource.Properties["InstanceId"]);
                nd.Properties.Add(new Item("guid", tpcId.ToString()));
                nd.Name = tpcNode.Resource.DisplayName;
                cols.Add(nd);
                var tpc = configServer.GetTeamProjectCollection(tpcId);

                // Get catalog of tp = 'Team Projects' for the tpc = 'Team Project Collection'
                var tpNodes = tpcNode.QueryChildren(
                          new Guid[] { CatalogResourceTypes.TeamProject },
                          false, CatalogQueryOptions.None);

                foreach (var p in tpNodes)
                {
                    var ndProj = new Node();
                    ndProj.Name = p.Resource.DisplayName;
                    nd.Children.Add(ndProj);
                }
            }

            return cols;

            /*
            WorkItemStore workItemStore = (WorkItemStore)collection.GetService(typeof(WorkItemStore));
            string qry = "SELECT [Title] From WorkItems Where [Work Item Type] = 'Bug' " +
                " AND [Iteration Path] = 'AML_Module\\Release 3\\Sprint 4' AND [Team Project]='AML_Module'";

            var res = workItemStore.Query(qry);
            foreach (var wi in res)
            {
                string s = wi.ToString();
            }*/
        }
Пример #2
0
 public IEnumerable<Node> GetTfsProjects(TfsConnection conn)
 {
     DataAccess da = new DataAccess();
     return da.GetTfsProjects(conn);
 }