如何获取 TFS 集合中所有项目的名称? [英] How to get the name of all projects in a TFS collection?

查看:37
本文介绍了如何获取 TFS 集合中所有项目的名称?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

关于如何从 TFS 获取集合,请参阅这里

On how to get the collections from TFS refer here

请参阅此处了解更多详情.这是关于 TFS 内容的最佳资源之一.

Please refer here for more details. This is one of the best resources on TFS stuff.

推荐答案

传入集合 guid,列表返回该特定集合中所有项目的名称.

The collection guid is passed in and the list returns the name of all projects in that particular collection.

    public IList<string> GetProjectsFormCollection(Guid collectionId)
{
    ICommonStructureService structureService = null;
    try
    {
        TfsTeamProjectCollection teamProjectCollection =
            _configurationServer.GetTeamProjectCollection(collectionId);
        teamProjectCollection.Authenticate();
        structureService =
            (ICommonStructureService)teamProjectCollection.GetService(typeof(ICommonStructureService));
    }
    catch (Exception e)
    {
        ApplicationLogger.Log(e);
    }

    var projectInfoList = new List<ProjectInfo>(structureService.ListAllProjects());
    IEnumerable<string> data = projectInfoList.Select(proj => proj.Name);
    List<string> list = data.ToList();
    return list;
}

这篇关于如何获取 TFS 集合中所有项目的名称?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆