简体   繁体   中英

Get correct telephone properties from Azure AD using Graph API

I'am trying to get user phones from Azure AD using Graph API but without luck.

If I in Powershell use the MsOnline module and issue the following command:

  get-azureAdUser | select userPrincipalName,mobile,telephonenumber 

I get a userlist including all the telephone numbers.

But if I in Graph use the command

 https://graph.microsoft.com/v1.0/users?$select=userPrincipalName,mobilephone,businessphones

the telephone fields is empty. The list contains the same users, but much of the information is missing.

Is it possible to get the phone numbers using Graph API by using some other command?

Few things to check:

  1. Please check access token you are using has necessary permissions. Refer documentation to learn about required permission to access. For example, you need to use either Directory.Read.All or User.Read.All. Both however require Admin Consent

  2. Also consider Phone Numbers are not available for personal Microsoft Accounts (MSA). They're only returned for Work/School accounts (AAD)

If you still face issues, share request id and timestamp from Graph Explorer.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM