问题
I've users with thousands of emails but I need to fetch only unread emails from specific people. I have the following call but it is not working 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 fetch emails from MS Office API "FROM" specific people without fetching all emails to our system?
回答1:
You were missing the character ? after messages. To filter the messages from specify user with unread messages, you can use the request below:
GET:https://graph.microsoft.com/v1.0/me/messages?$filter=from/emailAddress/address+eq+'xx@xxxx.onmicrosoft.com'+and+isRead+eq+false
回答2:
You can find an example of how to do this, and other examples of using common query parameters in Microsoft Graph in Microsoft Graph optional query parameters.
来源:https://stackoverflow.com/questions/41818683/how-can-i-filter-emails-from-a-specific-email-address-on-office-365-api