c# - 如何获取 TFS 2013 中所有用户的列表

标签 c# visual-studio-2012 tfs

我正在使用 Team Foundation Server (TFS) 2013 和 Visual Studio 2012。我需要 TFS 中所有用户的列表。

有没有办法使用 C# 获取 TFS 中的所有用户?

最佳答案

从TFS 2010获取用户列表,您可以尝试使用TFS API,请引用以下代码片段:

TfsTeamProjectCollection tfs = new TfsTeamProjectCollection(new Uri("url"));
tfs.EnsureAuthenticated();

IGroupSecurityService gss = tfs.GetService<IGroupSecurityService>();

Identity SIDS = gss.ReadIdentity(SearchFactor.AccountName, "Project Collection Valid Users", QueryMembership.Expanded);

Identity[] UserId = gss.ReadIdentities(SearchFactor.Sid, SIDS.Members, QueryMembership.None);

foreach (Identity user in UserId)
{
    Console.WriteLine(user.AccountName);
    Console.WriteLine(user.DisplayName);
}

请尝试此代码,上面的代码在 VS2010 和 VS2013 中有效。如果您有任何问题,请告诉我。

更多信息在 this link

关于c# - 如何获取 TFS 2013 中所有用户的列表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30639288/

相关文章:

c# - 模糊图像的选定部分

msbuild - 脚本不会为 VS2012 发布网站

tfs - 如何在 TFS2010 的 MSBuild 参数中进行变量替换?

c# - 我无法从 TFS 下载应用程序——错误地显示 "All files are up to date"

c# - 在 C# 中使用什么库进行 CSV 导入

c# - 奇怪的 C# 变量声明

c# - 现有连接被 WCF 中的远程主机强行关闭

c# - Array.FindIndex 在统一 C# 中始终为空

c++ - 在 Visual Studio 中使用 .def 而不是带有全局变量的 dllimport/dllexport

tfs - 是否可以为 MS Dynamics crm 2011 设置持续集成?