[英]How to get only the users that have a mailbox in Azure active directory using Microsoft Graph API?
I am using Microsoft Graph API to read emails ( /users/{id | userPrincipalName}/messages ) in the mailboxes of the users in my Azure active directory.我正在使用 Microsoft Graph API 阅读 Azure 活动目录中用户邮箱中的电子邮件 ( /users/{id | userPrincipalName}/messages )。 I have noticed that for some users, I get this error:
我注意到对于某些用户,我收到此错误:
HTTP error: 404
Error code: MailboxNotEnabledForRESTAPI or MailboxNotSupportedForRESTAPI
Error message: REST API is not yet supported for this mailbox.
Upon investigation, I found out that these users do not have a valid license and also don't have a mailbox attached to them.经过调查,我发现这些用户没有有效的许可证,也没有附加邮箱。 Ideally, I would like to only fetch the users that have a mailbox enabled.
理想情况下,我只想获取启用了邮箱的用户。 I tried checking the assignedLicenses property of each user and only fetch emails for those users that have a valid license assigned to them but, I'm not sure if this is a reliable method as users might have some other license and still not have a mailbox enabled.
我尝试检查每个用户的assignedLicenses属性,并且只为那些分配了有效许可证的用户获取电子邮件,但是我不确定这是否是一种可靠的方法,因为用户可能有其他一些许可证但仍然没有邮箱启用。
Can someone please suggest a straightforward way to only fetch the users that have mailboxes attached?有人可以建议一种简单的方法来仅获取附加邮箱的用户吗? Any help or hint shall be highly appreciated.
任何帮助或提示将不胜感激。
I don't see much options from Microsoft Graph perspective.从 Microsoft Graph 的角度来看,我没有看到太多选择。 Definitely checking the license is one good way, but you may not have much options with that.
绝对检查许可证是一种好方法,但您可能没有太多选择。 Being said that i see the following options,
据说我看到以下选项,
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.