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

半城伤御伤魂 提交于 2019-12-12 17:42:50

问题


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.


回答1:


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



回答2:


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.



来源:https://stackoverflow.com/questions/50349277/how-to-read-my-messages-from-inbox-or-sent-items-from-a-specific-email-address-a

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!