I want to get all the messages from inbox but issue is that it only show email but I want to have reply email as well of all emails. Thank you.

Atta Muhammad 1 Reputation point
2022-03-31T11:05:43.53+00:00

Hi I am using Microsoft Graph API, I want to fetch all the messages from Mail Inbox but unfortunately no success. When I tried following https://graph.microsoft.com/v1.0/me/mailFolders/Inbox/messages, it only shows email but i want to retrieve replied email/message as well.

Microsoft Security | Microsoft Graph
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Shivam Dhiman 6,081 Reputation points
    2022-03-31T15:47:14.83+00:00

    Hi @Atta Muhammad

    To get all the messages use this endpoint GET https://graph.microsoft.com/v1.0/me/messages

    By using this Endpoint https://graph.microsoft.com/v1.0/me/mailFolders/Inbox/messages we can get all the messages from inbox folder. You can use ?$count=true to retrieve the total count of messages/matching resources.

    188799-graph.png

    Note: Be aware of the known issue that this operation includes Microsoft Teams chat messages in its response.

    ----------

    As you can see replied mail in my Inbox.

    188852-mail1.png

    Depending on the page size and mailbox data, getting messages from a mailbox can incur multiple requests. The default page size is 10 messages. Use $top to customize the page size, within the range of 1 and 1000.
    To get the next page of messages, simply apply the entire URL returned in odata.nextLink to the next get-messages request..

    If you just want new mails where someone replied you can use https://graph.microsoft.com/v1.0/me/mailFolders/Inbox/messages/delta
    It will give you set of messages that have been added, deleted, replied, or updated in a specified folder.

    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have further questions about this answer, please click "Comment".

    2 people found this answer helpful.
    0 comments No comments

  2. Atta Muhammad 1 Reputation point
    2022-03-31T20:25:44.813+00:00

    I want to retrieve 188927-screenshot-from-2022-04-01-01-21-52.png

    As you can see there email and there is email reply. When I tried your suggested query it only retrieve email, I want to get reply email as well from inbox. I hope you understand now.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.