How to get subscription for new mail notification for inbox in mail using microsoft graph

Hattikoti, Roopa S 20 Reputation points
2023-09-06T11:09:41.03+00:00

Hello Everyone,

I am implementing subscription functionality using microsoft graph in C#.

This is my old code. Please suggest me how to achieve the same thing using microsoft graph. I need the onnotificationEvent and OnDisconnect event as well.

The below code written for the mails which are there in EWS servers.

                StreamingSubscription subscription = service.SubscribeToStreamingNotifications(
                    new FolderId[] { SharedMailbox },
                    EventType.NewMail
                    );
                StreamingSubscriptionConnection connection = new StreamingSubscriptionConnection(service, 30);
                connection.AddSubscription(subscription);
                connection.OnNotificationEvent += OnNotificationEvent;
                connection.OnDisconnect += OnDisconnect;
                connection.Open();
                Console.WriteLine("(" + System.DateTime.Now + ") Syncing Mailbox...");
                Console.Read();
Microsoft Security | Microsoft Graph
Developer technologies | C#
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Bruce (SqlWork.com) 78,006 Reputation points Volunteer Moderator
    2023-09-06T16:21:46.7266667+00:00
    0 comments No comments

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.