1
votes

I am invoking https://graph.microsoft.com/v1.0/users to get users from Azure Active Directory. I have registered an application with Directory.Read.All and User.ReadBasic.All permissions for a trial Azure account.

The response of this endpoint contains user information. Each user contains some basic fields (id, displayName, mail). Here, even though I have set email id of the user, mail field is coming null every time.

I need to know "do I need to purchase the azure subscription or office 365 subscription to get these mail fields enabled".

In short, how can I get these email fields non-null while calling the above API.

2

2 Answers

0
votes

The mail property is read-only. It is automatically populated by Exchange Online. Without Exchange Online (or syncing with an on-prem AD instance), this field will always be null.

0
votes

i got the solution.

create a trial account in microsoft office 365 business premium using the below link: https://signup.microsoft.com/Signup?OfferId=467eab54-127b-42d3-b046-3844b860bebf&dl=O365_BUSINESS_PREMIUM&culture=en-IN&country=IN&ali=1

Follow the steps while creating the account. It will allow us to create users in office 365. These users are like internal users of an organization. Now open azure portal with the above credential. All users of office 365 will be imported in active azure directory.

Now register an application with Read users basic profile delegated permission in active azure directory. note down client id , client secret and tenant domain to get access token for service to service authentication. This access token can be used to get user records which will be containing mail field as [email protected]