我正在使用 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 中工作。如果您有任何疑问,请告诉我。
更多信息请参见这个链接 https://social.msdn.microsoft.com/Forums/vstudio/en-US/1575bc23-55cf-48d8-9041-9d5910d1195b/getting-list-of-tfs-2010-all-users
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)