Getting messages in graph v5+

-- -- 892 Reputation points


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



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

1 answer

Sort by: Most helpful
  1. Antonio 250 Reputation points Microsoft Vendor

    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:$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