SOLVED

Graph API user all attributes/properties are null

Brass Contributor

Hi!

 

We are using the People Picker component in our app and it is making graph API calls that look correct, but in the response the user properties are all null except the ID.

 

Example, searching for "ellen" causes the following request:

 

https://graph.microsoft.com/v1.0/groups/fc598cd2-2af2-4d85-b5fe-c4287965c102/members/microsoft.graph...)

 

The response contains one user.  The object ID is correct but displayName (and all other properties) are null. 

 

 

 

{
    "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#users",
    "@odata.count": 1,
    "value": [
        {
            "businessPhones": [],
            "displayName": null,
            "givenName": null,
            "jobTitle": null,
            "mail": null,
            "mobilePhone": null,
            "officeLocation": null,
            "preferredLanguage": null,
            "surname": null,
            "userPrincipalName": null,
            "id": "b4cbe90a-2b84-4804-90d4-aeb341e63adf"
        }
    ]
}

 

 

 

Here are all the permissions I have granted.  Thanks for your help!

 

 
Calendars.ReadWrite
 
 
Calendars.ReadWrite.Shared
 
 
Channel.ReadBasic.All
 
 
email
 
 
Group.ReadWrite.All
 
 
GroupMember.Read.All
 
 
offline_access
 
 
openid
 
 
People.Read
 
 
profile
 
 
Team.ReadBasic.All
 
 
TeamsActivity.Send
 
 
User.Read
6 Replies
@keithfable - Could you please share which graph API are you calling or the sample which you are testing?

@Nivedipa-MSFT Hi!  We are calling the List Group Members endpoint.

 

The code is simply:

 

<PeoplePicker
 defaultSelectedUserIds={[context.userObjectId]}
 groupId={context?.groupId}
 selectionChanged={onSelectionChanged}
/>

@keithfable, add a Select method to include the properties you want to return.

.Select("displayName,givenMame,jobTitle").GetAsync();

@keithfable - Has @smartyme suggestion worked for you? or are you still facing this issue?
@keithfable - Could you please confirm is your issue resolved or are you still facing this issue?
best response confirmed by keithfable (Brass Contributor)
Solution
@smartyme @Nivedipa-MSFT

It turns out we were missing the Users.ReadBasic.All permission, so the response was coming back but the user details were missing.

This answer on StackOverflow helped me: https://stackoverflow.com/a/69072958/20588

Thanks for your help everyone
1 best response

Accepted Solutions
best response confirmed by keithfable (Brass Contributor)
Solution
@smartyme @Nivedipa-MSFT

It turns out we were missing the Users.ReadBasic.All permission, so the response was coming back but the user details were missing.

This answer on StackOverflow helped me: https://stackoverflow.com/a/69072958/20588

Thanks for your help everyone

View solution in original post