简体   繁体   English

如何使用 Microsoft Graph API 仅获取在 Azure 活动目录中拥有邮箱的用户?

[英]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.

相关问题 使用Microsoft Graph Api的Azure Active Directory用户和SaaS应用程序 - Azure Active Directory Users and SaaS Application using Microsoft Graph Api 如何使用 Microsoft Graph API 获取 Active Directory 用户的电话号码 - How to get phone numbers of Active Directory users with Microsoft Graph API 如何使用 Microsoft Graph api 从 azure 活动目录中获取所有用户属性 - How to get all user attributes from azure active directory using Microsoft Graph api 如何使用Azure Active Directory图谱API获取属于AppRole的所有用户 - How to get all users that belong in an AppRole using Azure Active Directory Graph API 使用AAD Graph API或Microsoft Graph API获取Azure Active Directory应用程序权限 - Get Azure Active Directory application permissions using AAD Graph API or Microsoft Graph API Microsoft Graph API 权限更改未使用 Azure Active Directory 传播 - Microsoft Graph API permissions changes not propagating using Azure Active Directory 如何从 Azure Active Directory 获取我的 API 和 Microsoft Graph 的有效访问令牌? - How to Get a valid access token for my API and Microsoft Graph from Azure Active Directory? Azure Active Directory图api-用户 - Azure Active Directory Graph Api - Users 如何使用图谱API将用户添加到Azure Active Directory - How to Add users to Azure Active Directory with Graph API 从Azure Active Directory Graph Api迁移到Microsoft Graph Api - migrating from Azure Active Directory Graph Api to Microsoft Graph Api
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM