【问题标题】:Get Team Project Names from TFS using Powershell使用 Powershell 从 TFS 获取团队项目名称
【发布时间】:2015-12-30 22:51:54
【问题描述】:

我需要在团队项目集合中生成团队项目名称列表。

有没有办法做到这一点?也许使用 Powershell?

【问题讨论】:

标签: visual-studio powershell tfs


【解决方案1】:

这是我使用的。可能有更好的方法,但这有效。这是如何将其绑定到下拉列表。 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();

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2013-05-30
    • 2023-03-24
    • 2011-10-15
    • 1970-01-01
    • 2013-08-20
    • 1970-01-01
    • 2011-07-03
    • 2012-03-05
    相关资源
    最近更新 更多