我的目标是在 TFS 中检索整个用户的整个电子邮件地址。我终于成功地获得了用户的 SID 列表,但我认为它不行,因为我检索 SID 的组中有组,我不知道如何访问它。这是我代码中的重要部分,希望在这里得到答案。
TeamFoundationIdentity[] projectGroups = _ims.ListApplicationGroups(projectUri, ReadIdentityOptions.None);
Dictionary<IdentityDescriptor, object> descSet = new Dictionary<IdentityDescriptor, object>(IdentityDescriptorComparer.Instance);
foreach (TeamFoundationIdentity projectGroup in projectGroups)
{
descSet[projectGroup.Descriptor] = projectGroup.Descriptor;
}
// Expanded membership of project groups
projectGroups = _ims.ReadIdentities(descSet.Keys.ToArray(), MembershipQuery.Expanded, ReadIdentityOptions.None);
// Collect all descriptors
foreach (TeamFoundationIdentity projectGroup in projectGroups)
{
foreach (IdentityDescriptor mem in projectGroup.Members)
{
TeamFoundationIdentity[] _identities = _ims.ReadIdentities(new IdentityDescriptor[] {mem}, MembershipQuery.Expanded, ReadIdentityOptions.None);
foreach(TeamFoundationIdentity id in _identities)
{
//the sid
Console.WriteLine(id.Descriptor.Identifier);
}
}
}
}