【发布时间】:2015-12-30 22:51:54
【问题描述】:
我需要在团队项目集合中生成团队项目名称列表。
有没有办法做到这一点?也许使用 Powershell?
【问题讨论】:
-
可能,是的。使用 TFS API 可能会获得最好的运气。看看SDK or other .Net TFS libraries。
标签: visual-studio powershell tfs
我需要在团队项目集合中生成团队项目名称列表。
有没有办法做到这一点?也许使用 Powershell?
【问题讨论】:
标签: visual-studio powershell tfs
这是我使用的。可能有更好的方法,但这有效。这是如何将其绑定到下拉列表。 c#
Uri myUri = new Uri("https://tfs.mytfsserver.com/tfs");
// Get a TfsConfigurationServer instance
TfsConfigurationServer configServer = TfsConfigurationServerFactory.GetConfigurationServer(myUri);
configServer.EnsureAuthenticated();
// Get the CatalogNode that represents the hierarchy root
CatalogNode rootNode = configServer.CatalogNode;
// Get the Team Project Collections that descend from the root node
ReadOnlyCollection<CatalogNode> teamProjectCollections = rootNode.QueryChildren(
new Guid[] { CatalogResourceTypes.ProjectCollection },
false,
CatalogQueryOptions.None);
CatalogNode teamProjectCollection = teamProjectCollections[0];
// Get the Team Projects that belong to the Team Project Collection
ReadOnlyCollection<CatalogNode> teamProjects = teamProjectCollection.QueryChildren(
new Guid[] { CatalogResourceTypes.TeamProject },
false,
CatalogQueryOptions.None);
ddl_TeamProjects.DataSource = teamProjects.Select(c => c.Resource.DisplayName).ToArray();
ddl_TeamProjects.DataBind();
【讨论】: