如何仅列出每个 AD 域下的安全组

问题描述

我是 Active Directory 的新手,请给我推荐一些示例,用于在 c# 中仅列出每个 AD 域下的安全组

解决方法

试试

GraphServiceClient graphClient = new GraphServiceClient( authProvider );

var groups = await graphClient.Groups
    .Request()
    .GetAsync();

这将返回所有组,您可以依靠 groupTypes 属性或 securityEnabled bool 来检查它是安全组还是 Microsoft365。有关这些属性检查的更多信息,https://docs.microsoft.com/en-us/graph/api/resources/group?view=graph-rest-1.0