Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to read my messages from Inbox or sent items from a specific email address and within a particular interval?

i am working in graph explorer API to read the email of my account. the idea is to pass an email address and a date interval to Graph API and it should return me the same Messages Associated with this email.it could be from sent item and inbox can be both. i am useing below api:

https://graph.microsoft.com/v1.0/me/messages?$Search="Aj****@t**maxa****icas.com
and Sent >= 2018-05-09"

but this is giving Messages from my inbox not from sent Email.Can any 1 help me out. Thanks.

like image 467
ashish jayara Avatar asked Oct 19 '25 14:10

ashish jayara


2 Answers

The /me/messages endpoint works against the mailbox but there are exceptions. Certain mail folders are specifically excluded: Outbox, Send Items, Junk, Deleted Items. In general, folders that contain outgoing or otherwise ignored mail (i.e. junk, trash) require special handling.

In order to work against a specific folder, you need to specify that folder in your URL path:

/me/mailFolders/{folder}/messages

The {folder} can be folder's id (obtained by listing the folders via /me/mailFolders) or a "well-known folder name" that is pre-defined by Exchange (ArchiveRoot, ConversationHistory, DeletedItems, Drafts, Inbox, JunkEmail, Outbox, or SentItems).

So to obtain the messages in the Sent Items folder, you would call:

https://graph.microsoft.com/v1.0/me/mailFolders/SentItems/messages
like image 79
Marc LaFleur Avatar answered Oct 22 '25 06:10

Marc LaFleur


https://graph.microsoft.com/v1.0/me/mailFolders/SentItems/messages$search="Received>=2018-05-16T11:55:01 AND Participants:A***@tr*****c**as.com"&$top=10 

This works fine for me.

you can pass the yyyy-mm-dd format also in the Revived date.

like image 33
ashish jayara Avatar answered Oct 22 '25 06:10

ashish jayara



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!