Different filter escaping behaviour in batch and direct requests #2708
Labels
status:waiting-for-triage
An issue that is yet to be reviewed or assigned
type:bug
A broken experience
Describe the bug
I'm trying to find a user and a selection of their properties through their email. Currently I'm building a filter to find said user like so:
identities/any(id:id/issuer eq ' ' and id/issuerAssignedId eq '{emailAddress}')
For most email addresses, the filtering works as expected for both direct requests using
_GraphServiceClient.Users.GetAsync()
as well as batch requests and building the requests with_GraphServiceClient.Users.ToGetRequestInformation()
.I've noticed that some of our users aren't returned by the batch requests but provide valid responses through a direct request.
The emails have in common that they contain a '+' character, e.g.
[email protected]
. Upon further investigation I've noticed that the Graph API can't handle the '+' character and needs it to be escaped.Apparently, the filter string is escaped when requesting
_GraphServiceClient.Users.GetAsync()
but not when using_GraphServiceClient.Users.ToGetRequestInformation()
followed by a batch request.Expected behavior
The filter behaviour should be equal throughout the SDK and not differ between usages. I believe the filter should also be escaped when build a request and sending it through a batch request.
How to reproduce
Assuming I have a list of emails for which I want some B2C properties like the display name.
When I use the the SDK by sending the requests one by one like so, everything works as expected:
But creating a batch request when the list of email addresses might become bigger creates empty results for emails with a '+' character. The request is built like this:
SDK Version
5.59.0
Latest version known to work for scenario above?
No response
Known Workarounds
I've fixed the issue by explicitly escaping the emailAddress before using it in the filter:
But this creates an odd situation since escaping the emailAddress with a direct request to
_GraphServiceClient.Users.GetAsync()
breaks the direct request. So I need to handle the email addresses differently which creates a confusing situation in the code base.Debug output
No response
Configuration
Other information
No response
The text was updated successfully, but these errors were encountered: