Reputation: 41
I try to filter the following user using Microsoft Graph by userPrincipalName:
{
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#users",
"value": [
{
"businessPhones": [],
"displayName": "Champi Non Buen Dia",
"givenName": "buendiachampi",
"jobTitle": null,
"mail": "[email protected]",
"mobilePhone": null,
"officeLocation": null,
"preferredLanguage": null,
"surname": "urrutia",
"userPrincipalName": "champinon.buendia_champi.com#EXT#@avtestonline.onmicrosoft.com",
"id": "c6d071ee-5d89-49bb-ac23-768720e5eff4"
}
]
}
When I request with the following URL I get the above JSON result:
https://graph.microsoft.com/v1.0/users?$filter=startswith(userPrincipalName,'champinon.buendia_champi.com')
, but if I add to the filter #EXT# I get a bad request result, how can I pass that character in the filter value?
https://graph.microsoft.com/v1.0/users?$filter=startswith(userPrincipalName,'champinon.buendia_champi.com#EXT#')
The reason why I need to do as is, is that the user must be forced to enter the full username and not a part of it, that #EXT# makes the filtering more accurate, because the username entered in must match with the #EXT#.
Upvotes: 1
Views: 413
Reputation: 41
The value of #EXT# must be passed encoded as %23EXT%23:
https://graph.microsoft.com/v1.0/users?$filter=startswith(userPrincipalName,'edgardo.urrutia_tcs.com%23EXT%23@')
Upvotes: 1