How can I filter emails from a specific email address in the Office 365 API?

I have users with thousands of emails, but I need to get only unread emails from specific people. I have the following call, but it does not work for me.

curl -i https://graph.microsoft.com/v1.0/me/messages$filter=From/EmailAddress/Address eq ' alerts-noreply@mail.windowsazure.com ' H 'Content-Type: application/x-www-form-urlencoded' -H 'Authorization: Bearer token ....' { "error": { "code": "BadRequest", "message": "Unsupported segment type. ODataQuery: users/020f1da4-031d-4....26513bb0/messages=From/EmailAddress/Address", "innerError": { "request-id": "2aaaaeb...42-ffc6d0e44f3d", "date": "2017-01-24T01:30:44" } } } 

How can I receive emails from the MS Office API "FROM" of specific people without receiving all emails in our system?

+1
source share
2 answers

Did you fail to get the character ? after messages . To filter messages on behalf of a user with unread messages, you can use the query below:

 GET:https://graph.microsoft.com/v1.0/me/messages?$filter=from/emailAddress/address+eq+' xx@xxxx.onmicrosoft.com '+and+isRead+eq+false 
+2
source

You can find an example of how to do this, and other examples of using the general query parameters in Microsoft Graph in the optional Microsoft Graph query parameters .

0
source

Source: https://habr.com/ru/post/1236271/


All Articles