I am trying to use Microsoft Graph Api to get the details of a specific user.
I have a problem that can be demonstrated using the Graph Explorer: https://developer.microsoft.com/en-us/graph/graph-explorer
If I run this query:
https://graph.microsoft.com/v1.0/users
I get a list of users, including their ID.
I know I can get the details of just one user by appending the id to the url. For example, this query:
https://graph.microsoft.com/v1.0/users/f71f1f74-bf1f-4e6b-b266-c777ea76e2c7
Results in the details of one specific user.
{
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#users/$entity",
"id": "f71f1f74-bf1f-4e6b-b266-c777ea76e2c7",
"businessPhones": [],
"displayName": "CIE Administrator",
"givenName": "CIE",
"jobTitle": null,
"mail": "admin@CIE493742.onmicrosoft.com",
"mobilePhone": "+1 3528700812",
"officeLocation": null,
"preferredLanguage": "en-US",
"surname": "Administrator",
"userPrincipalName": "admin@CIE493742.onmicrosoft.com"
}
However, in my case, it would be easier to apply a $filter
query on the id
field.
Here is what I have tried, and the errors I get:
Attempt One
.../users?$filter=id eq f71f1f74-bf1f-4e6b-b266-c777ea76e2c7
Returns the following message:
A binary operator with incompatible types was detected. Found operand types 'Edm.String' and 'Edm.Guid' for operator kind 'Equal'.
Attempt Two
..../users/$filter=id eq guid'f71f1f74-bf1f-4e6b-b266-c777ea76e2c7'
Returns the following message:
Unrecognized 'Edm.String' literal 'guid'f71f1f74-bf1f-4e6b-b266-c777ea76e2c7'' at '6' in 'id eq guid'f71f1f74-bf1f-4e6b-b266-c777ea76e2c7''.