0
votes

I'm trying to read the emails for my mails box via graph API with Powershell. I got data but how to filter the data by sender. sender : @{emailAddress=} and how to get mails from specific users $uri = "https://graph.microsoft.com/v1.0/users/$Mailbox/messages?$filter=(from/emailAddress/address) eq '[email protected]'" - this not working showing like this in output, but once converted to JSON I can see the sender.

1

1 Answers

0
votes

If my understanding is correct, you would like to filter messages that are sent from a specific user and sent to a specific user.

AFAIK, The "To Recipient" is complex object is NOT filterable. Meaning you will not be able to use it with the $filter query parameter.

You can make use of the Search Query parameter ($search) to achieve your goal.

Sample Request :

https://graph.microsoft.com/v1.0/me/messages?$search="to:<EMAIL ADDRESS> and from:<EMAIL ADDRESS>"