如何在我们的 Azure AD 中查询 graph.windows.net 中确实设置了电子邮件属性的帐户?我要求查询字符串,甚至更好的是使用 ActiveDirectoryClient 的 C# 语句。
似乎不可能使用 $filter=email neq '' 或其他类似的 $filter 构造来排除没有设置电子邮件属性的用户。
如何在我们的 Azure AD 中查询 graph.windows.net 中确实设置了电子邮件属性的帐户?我要求查询字符串,甚至更好的是使用 ActiveDirectoryClient 的 C# 语句。
似乎不可能使用 $filter=email neq '' 或其他类似的 $filter 构造来排除没有设置电子邮件属性的用户。
您可以迭代所有 Azure AD 用户并检查用户是否有邮件:
ActiveDirectoryClient activeDirectoryClient = AuthenticationHelper.GetActiveDirectoryClientAsApplication();
List<IUser> users = activeDirectoryClient.Users.ExecuteAsync().Result.CurrentPage.ToList();
var mailUsers = new List<IUser>();
foreach (IUser user in users)
{
if(user.Mail != null)
{
mailUsers.Add(user);
}
}
请在以下位置查看示例应用程序
https://github.com/Azure-Samples/active-directory-dotnet-graphapi-console