I'm trying to get user incoming messages (emails) by calling list messages endpoint and filter out the mails he sent.
The problem is that the user mail address starts with #
(i.e. the mail is something like #a@b.com
) and so when sending the request to the full url:
url = "https://graph.microsoft.com/v1.0/Users/{user_id}/messages?$filter=sender/emailAddress/address ne '#a@b.com'"
I'm getting back a 400
(bad request) status code saying "Invalid filter clause"
If I remove the #
then the request works (getting back 200
) but then I might get mails where the sender is the user itself (i.e. #a@b.com
).
Is there a workaround using GRAPH API? (I'm aware of the possibility to filter mails by myself after getting response.. that's not what I'm looking for..)
Thanks
I think I found the solution - to add '
before the special character (in my case, #
) so if I change the filter to be .. ne ''#a@b.com'
then it seems to work fine.