Velojet
Velojet

Reputation: 948

Microsoft Graph: OData $select query parameter doesn't select

The MS Graph 'Get a user' documentation says:

If you need a different property set, you can use the OData $select query parameter

but it appears not to work, either in my code or in the Graph Explorer. In both, the query https://graph.microsoft.com/v1.0/me?$select=displayName returns the full set of user properties:

{
    "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#users(surname)/$entity",
    "displayName": "<my name>",
    "surname": "<my surname>",
    "givenName": "<my given name>",
    "id": "<my <my ID>>",
    "userPrincipalName": "<my email>",
    "businessPhones": [<my phones>],
    "jobTitle": <my job title>,
    "mail": null,
    "mobilePhone": null,
    "officeLocation": null,
    "preferredLanguage": null
}

How can I get my desired subset of user properties (e.g. just the displayName)?

[EDITED]

In response to Lee_MSFT's Graph Explorer screenshot below, here's what I get from the exact same query:

... so why the difference? What's going off-beam with my query?

Upvotes: 0

Views: 1358

Answers (2)

Jason Johnston
Jason Johnston

Reputation: 17692

I'm going to guess that you're using a personal Microsoft Account (sometimes referred to as an MSA or an Outlook.com account), where as Lee is using an Office 365 account. I reproduce your behavior when I use an MSA, but do not in Office 365. MSA accounts behave a little differently in Graph. I'll report this to the Graph folks.

In the meantime, is there something that's breaking for you? I know you're getting more properties than you want, but at least nothing is missing :).

Upvotes: 1

Lee
Lee

Reputation: 5493

Here is my test result which works fine. enter image description here

Upvotes: 1

Related Questions