$search and $expand operator does not work in graph api users

Viewed 373

I am using graph api to get users and groups information, but looks it does not work, can anyone help me?

my query uri:

https://graph.microsoft.com/v1.0/users?$search="displayname:user"&$count=true&$top=250&$expand=transitiveMemberOf($select=displayname)

and the error message:

{
"error": {
    "code": "Request_UnsupportedQuery",
    "message": "Request with $search query parameter only works through MSGraph with a special request header: 'ConsistencyLevel: eventual'",
    "innerError": {
        "date": "2022-01-14T11:06:50",
        "request-id": "e57ce8c4-f1bc-4b32-8559-1fac5c133b9d",
        "client-request-id": "c85557de-6e80-10b6-7c68-d84334181dd0"
    }
}

}

and i added the request header[ConsistencyLevel: eventual] nothing changed.

2 Answers

Adding request header ConsistencyLevel:eventual and removing &$expand=transitiveMemberOf($select=displayname)

related documents:

troubleshooting your error message

expand parameter

enter image description here

According the documentation and github issue, unfortunately $search (requiring the advanced query parameters) doesn't support $expand.

Related