问题
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