Using Graph API, How to get notification when user received a new mail?

sne 0 Reputation points


My question is how to get notification when new mail is received using a Graph API. I'm using c# in console app. I went through documentation. but didn't get it much. exactly what I need to do?

Could anyone help me with steps or any sample code?


Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
1,328 questions
Microsoft Graph Mail API
Microsoft Graph Mail API
A Microsoft API that supports accessing data in users' primary mailboxes and in shared mailboxes.
798 questions
Microsoft Graph Notifications API
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Sayantan Ganguly 1,145 Reputation points

    Hello Sneha Zagade.

    Thanks for reaching out!

    Using Microsoft Graph API, to get notifications when new mail is received, you can use subscriptions. A subscription allows a client app to receive change notifications about changes to data in Microsoft Graph. Please refer to the documentation for more details.

    You can create subscription to receive notifications of mails using the below sample endpoint:

    Content-type: application/json
       "changeType": "created",
       "notificationUrl": "",
       "resource": "me/messages",
       "clientState": "secretClientValue",
       "latestSupportedTlsVersion": "v1_2"

    Hope this helps.

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