4

I'm using Graph to get all users on my sharepoint online site. The code works just fine expect for one example.

I've the sharepoint users is synced from azure ad, then im not able to get the properties of the user.

Here is the webApiPermissionRequests:

"webApiPermissionRequests": [
      {
        "resource": "Microsoft Graph",
        "scope": "User.ReadBasic.All"
      },
      {
        "resource": "Microsoft Graph",
        "scope": "Contacts.Read"
      },
      {
        "resource": "Microsoft Graph",
        "scope": "User.Read.All"
      }
    ]

The request where i get my users:

const users: MSGraphClient = this.context.serviceScope.consume(MSGraphClient.serviceKey);
users
  .api("/users")
  .select("displayName,mobilePhone,mail,photo,department,jobTitle,mailNickname")
  .top(999)
  .get((error, response: any, rawResponse?: any) => {

As i said, Everything works just fine expect when a user is imported from the Azure AD.

Can anyone tell me why all properties except displayName is null when it's an imported user.

UPDATED

I've added a picture. It' is only the Mobile Phone number (Mobiltelefon) that I'm able to get with the api above. The rest of the data and information is not being received. Let's take Office (Kontor) is coming from the azure add and is not is NOT being received in the API.

enter image description here

  • Based on your description, I have tried your issue, but there are no any error. I get the `displayName` property and it is not null when the account is imported from Azure AD – Keen Jin Sep 20 '18 at 01:59
  • Could you please provide more information about how do you create this account? – Keen Jin Sep 20 '18 at 02:00
  • @kikang I don't have a problem getting the displayname, take for example mobilePhone number, if it's imported from azure ad, it will return null in mobile phone number –  Sep 20 '18 at 06:07
  • @Peter I'm a bit confused after reading your question. You said that you are able to get the mobile number via MS Graph API but then in the comment above you said it is null... Please clarify what the problem is. A clear example would be appreciated, e.g. user A created via O365 Admin and user B created in portal.azure.com... – FIL Sep 28 '18 at 13:15

1 Answers1

0

According to your description, you want to get the user's properties by MS Graph API.

Based on my test, we can get the properties. For your case, we should check the properties whose the value is null.

Check the properties in Azure AD whether it is null.

Keen Jin
  • 1,060
  • 1
  • 6
  • 8