Getting messages in graph v5+

-- -- 787 Reputation points
2023-04-29T06:25:26.4266667+00:00

Hi

In graph v5+, how can I get a user by his email and then use it to get unread messages from user's inbox?

Thanks

Regards

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
9,105 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Antonio 260 Reputation points Microsoft Vendor
    2023-05-04T13:36:01.0033333+00:00

    Thanks for posting in Q&A forum.

    For the statement "graph v5+", this seems to indicate for Microsoft Graph API SDK version 5 and above.

    If so, we have a tutorial written with .NET SDK version 7.0.102. for listing the contents of an inbox.

    Further learning path / modules for exploring using Microsoft Graph for ASP.NET core development.

    Also, for unread emails only include the filter:

    https://graph.microsoft.com/v1.0/me/mailFolders/Inbox/messages?$filter=isRead ne true

    var graphClient = new GraphServiceClient(requestAdapter);
    
    var result = await graphClient.Me.MailFolders["{mailFolder-id}"].Messages.GetAsync((requestConfiguration) =>
    {
    	requestConfiguration.QueryParameters.Filter = "isRead ne true";
    });
    

    --please don't forget to upvote and Accept as answer if the reply is helpful--

    0 comments No comments