我想在DropDown中列出TFS用户组,并根据用户组的选择,我需要使用TFS API填充该特定组中的用户。
答案 0 :(得分:2)
最后一个例子可能是最相关的。
IGroupSecurityService gss = (IGroupSecurityService)server.GetService(typeof(IGroupSecurityService));
Identity[] UserId = gss.ReadIdentities(SearchFactor.Sid, SIDS.Members, QueryMembership.None);
答案 1 :(得分:1)
// Connect to the team project collection.
TfsConfigurationServer tfsServer = m_tfsServer;
Guid collectionGuid = m_collectionGuid;
TfsTeamProjectCollection tpc = tfsServer.GetTeamProjectCollection(collectionGuid);
// Get the group security service.
var gss = tpc.GetService<IGroupSecurityService2>();
// Retrieve each user's SID.
Identity sids = gss.ReadIdentity(SearchFactor.AccountName, "[My Team Project]\\Contributors", QueryMembership.Expanded);
// Resolve to named identities.
Identity[] users = gss.ReadIdentities(SearchFactor.Sid, sids.Members, QueryMembership.None);