Azure devops VS团队服务-安全报告摘要显示每个项目中角色的用户

Azure devops VS团队服务-安全报告摘要显示每个项目中角色的用户,azure-devops,Azure Devops,是否有方法针对Team Services中的安全设置运行报告,以显示按角色和项目分组的所有用户?没有报告显示Team Services中的用户/组。您可以参考下面的代码来检索必要的信息 NetworkCredential cred = new NetworkCredential("XX", "XX"); string url = "https://XX.visualstudio.com/DefaultCollection"; TfsTeamProjectCollecti

是否有方法针对Team Services中的安全设置运行报告,以显示按角色和项目分组的所有用户?

没有报告显示Team Services中的用户/组。您可以参考下面的代码来检索必要的信息

NetworkCredential cred = new NetworkCredential("XX", "XX");            
 string url = "https://XX.visualstudio.com/DefaultCollection";
TfsTeamProjectCollection collection = new TfsTeamProjectCollection(new Uri(url), cred);
collection.EnsureAuthenticated();

           var structureService= collection.GetService<ICommonStructureService>();
            var teamprojects = structureService.ListAllProjects();
            TfsTeamService teamService = collection.GetService<TfsTeamService>();
            IGroupSecurityService gss = collection.GetService<IGroupSecurityService>();
foreach (var tp in teamprojects)
            {
                var teamList = teamService.QueryTeams(tp.Uri);
                foreach (var currentTeam in teamList)
                {
                    Identity[] appGroups = gss.ListApplicationGroups(currentTeam.Project);
                    foreach (var g in appGroups)
                    {
                        Identity[] groupMembers = gss.ReadIdentities(SearchFactor.Sid, new string[] { g.Sid }, QueryMembership.Expanded);
                   }
                }
  }
NetworkCredential cred=新的网络凭据(“XX”、“XX”);
字符串url=”https://XX.visualstudio.com/DefaultCollection";
TfsatmProjectCollection=新TfsatmProjectCollection(新Uri(url),cred);
集合。确保重新验证();
var structureService=collection.GetService();
var teamprojects=structureService.listalprojects();
TfsTeamService teamService=collection.GetService();
IGroupSecurityService gss=collection.GetService();
foreach(团队项目中的var tp)
{
var teamList=teamService.querytams(tp.Uri);
foreach(团队列表中的var currentTeam)
{
Identity[]appGroups=gss.ListApplicationGroups(currentTeam.Project);
foreach(appGroups中的var g)
{
Identity[]groupMembers=gss.readIdentifies(SearchFactor.Sid,新字符串[]{g.Sid},QueryMembership.Expanded);
}
}
}

另一方面,REST API可能会对您有所帮助。

为什么会投反对票?如果我能让这个问题更具相关性或信息性,我会洗耳恭听。