Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to filter messages by recipient in Microsoft Graph Api. One or more invalid nodes

Tags:

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?

like image 452
Dave Avatar asked Sep 28 '16 17:09

Dave


1 Answers

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]"

like image 133
eggm0n Avatar answered Sep 28 '22 19:09

eggm0n