Search code examples
graphmicrosoft-graph-api

Why does Graph API return a "not found" error when querying for user attributes?


I am relatively new to Microsoft Graph API. I am trying to extract a list of user profile information. When I run either of the following requests, I get a valid response:

Get displayname and birthday for single user:

GET https://graph.microsoft.com/v1.0/users/___userID___?$select=displayName,birthday

Get displayname for all users:

GET https://graph.microsoft.com/v1.0/users/?$select=displayName

However, when I try to run the following query, I receive an error:

Get displayname and birthday for all users:

GET https://graph.microsoft.com/v1.0/users/?$select=displayName,birthday

The error I receive is as follows:

{
    "error": {
        "code": "UnknownError",
        "message": "",
        "innerError": {
            "date": "2023-02-02T05:57:08",
            "request-id": "e8ae37af-3478-4446-a328-9d79f7aac0fc",
            "client-request-id": "a667c3f1-0183-3382-c601-2197456a758d"
        }
    }
}

This error seems to occur with only some attribute types, forexample hiredate and birthday. If I query for displayname and userprincipalname, I do get the same error.

I would appreciate any suggestions.


Solution

  • According to the documentation, properties aboutMe, birthday, hireDate, interests, mySite, pastProjects, preferredName, responsibilities, schools, skills, mailboxSettings cannot be returned within a user collection.

    They are only supported when retrieving a single user.