TFS からコレクションを取得する方法については、こちらを参照してください
詳しくはこちらをご覧ください。これは、TFS に関する最高のリソースの 1 つです。
コレクション GUID が渡され、リストはその特定のコレクション内のすべてのプロジェクトの名前を返します。
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;
}