我有一个与本地AD同步的Azure AD实例。我创建以下图形查询以选择所有成员所属的组。但是,当此查询返回MemberOf
属性时,它始终为null
,而通过Azure门户查看用户和组时并非如此。我在做什么错了?
List<User> users = new List<User>();
IGraphServiceUsersCollectionPage userQuery = await client.Users.Request().Expand(u => u.MemberOf).GetAsync();
users.AddRange(userQuery);
while (userQuery.NextPageRequest != null)
{
userQuery = await userQuery.NextPageRequest.GetAsync();
users.AddRange(userQuery);
}
IEnumerable<IUserMemberOfCollectionWithReferencesPage> memberof = users.Where(u => u.MemberOf != null).Select(u => u.MemberOf);