Unable to get user properties from users imported by Azure AD

Viewed 357

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

1 Answers

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.

Related