【问题标题】:How do I get list of all users in TFS 2013如何获取 TFS 2013 中所有用户的列表
【发布时间】:2016-11-09 07:09:32
【问题描述】:

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

有没有什么方法可以使用 C# 获取 TFS 中的所有用户?

【问题讨论】:

  • 谢谢约翰。我想在代码中查看列表。不在用户界面中。如果你有示例代码可以分享吗?

标签: c# visual-studio-2012 tfs


【解决方案1】:

从TFS 2010获取用户列表,可以尝试使用TFS API,请参考以下代码sn-p:

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

中的更多信息

【讨论】:

  • @a1rPun:谢谢
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2017-01-02
  • 2017-07-19
  • 2015-03-13
  • 1970-01-01
  • 2017-01-12
  • 2017-01-05
  • 2011-12-24
相关资源
最近更新 更多