Bassie
Bassie

Reputation: 10400

Microsoft Graph API doesn't return the properties I need

Trying to do a simple query using ms graph API to get the user's aboutMe property:

    string filter = @"
startswith(displayName,'Bassie')
";

var users = await graphClient.Users
    .Request()
    .Filter(filter)
    .Select("aboutMe")
    .GetAsync();

But I just keep getting

{Code: NotImplementedMessage: This operation target is not yet supported. Inner error}

Where the InnerError doesn't contain any useful information.

It works fine when I do the same with mail.

Why is this? I'm fairly sure I have retrieved aboutMe section using graph API before, but I don't remember exaclty how...

When trying it with Graph Explorer

https://graph.microsoft.com/v1.0/users?$select('AboutMe')

It returns objects like this

"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#users",
"@odata.nextLink": "https://graph.microsoft.com/v1.0/users?=%24select(%27AboutMe%27)&$skiptoken=X%2744537074020001000000273A24504A424632302D344D474E324C34484551384E40776F726C6579706172736F6E732E636F6D29557365725F62363964646464302D353865332D343537332D386639332D363033333731386231336237B900000000000000000000%27",
"value": [
    {
        "id": "d6a2b540-bd56-420f-bb46-bb46d6a2b540",
        "businessPhones": [],
        "displayName": "54-3-24",
        "givenName": "user",
        "jobTitle": null,
        "mail": "[email protected]",
        "mobilePhone": null,
        "officeLocation": null,
        "preferredLanguage": null,
        "surname": "surname",
        "userPrincipalName": "[email protected]"
    }

What does this mean? How am I supposed to retrieve the properties that I need? And if only some are available, is there a reference for this? I don't want to have to test out every single property before I know which are available..

Upvotes: 2

Views: 2385

Answers (2)

Vadim Gremyachev
Vadim Gremyachev

Reputation: 59378

Unfortunately aboutMe property of user entity could not be retrieved for a collection of users, only for a single user (entity) it is supported to retrieve this property like this:

/beta/users/me?$select=aboutMe

Refer this thread that lists all the properties that could not be retrieved per user collection.

The query:

https://graph.microsoft.com/v1.0/users?$select('AboutMe')

is invalid and in your case select query option expression is simply ignored since it is provided incorrectly, here is the example how to specify select query option (follow this article for a more details):

/beta/users?$select=email,displayName

Upvotes: 1

Karlheinz Reinhardt
Karlheinz Reinhardt

Reputation: 1075

/v1.0/users?$filter=startswith(displayName,'Bassie')&$select('AboutMe')

will execute properly but, the c# sdk will resolve your Queries to the following format

/v1.0/users?$filter=startswith(displayName,'Bassie')&$select=AboutMe

"BaseRequest.cs, ~line 310"

However select

/v1.0/users?$select=AboutMe

seems to throw the NotImplementedException.

Not sure if this is a bug, but i would recommend you to submit a bug report

Upvotes: 1

Related Questions