MS Graph User Memberof始终为null

时间:2018-09-05 14:55:09

标签: c# microsoft-graph

我有一个与本地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);

0 个答案:

没有答案