I am trying to get a list of messages that are filtered by recipient from Microsoft Graph API. The url I am using for the request is:
https://graph.microsoft.com/beta/me/messages?$filter=toRecipients/any(r: r/emailAddress/address eq '[Email Address]')
But I am getting this is the response:
{ "error": { "code": "ErrorInvalidUrlQueryFilter", "message": "The query filter contains one or more invalid nodes.", "innerError": { "request-id": "7db712c3-e337-49d9-aa8d-4a5d350d8480", "date": "2016-09-28T16:58:34" } } }
A successful request should look like this (with a lot more data that I have omitted).
{ "@odata.context": "https://graph.microsoft.com/beta/$metadata#users('99999999-9999-9999-9999-999999999999')/messages", "@odata.nextLink": "https://graph.microsoft.com/beta/me/messages?$skip=10", "value": [ { "toRecipients": [ { "emailAddress": { "name": "[Name]", "address": "[Email Address]" } } ], } ] }
The request works if I remove the filter, and I am able to perform requests with simpler filters.
Is there a problem with my URL, or is there another way to make the request?
Another way to make the request might be to not use filter and use search instead, depending on exactly what you want (and you may have already tried this):
https://graph.microsoft.com/beta/me/messages?$search="to:[Email Address]"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With