How to subscribe to Microsoft Graph change notifications in a separate ASP.NET endpoint using SDK

Viewed 176

I have 2 ASP.NET Core sites:

  1. allow multiple users to sign in to the Microsoft Identity platform then cache their tokens in SQL Server
  2. load the tokens to subscribe and receive Microsoft Graph change notifications, e.g. subscribe to calendar event changes in the default calendar of each signed in user.

Microsoft has a sample project that sorted out my token caching/loading need: Accessing the logged-in user's token cache from background apps, APIs and services.

For Microsoft Graph change notification, there is a REST API, but I'd like to know if there is a way to subscribe in the Microsoft Graph SDK.

The sample project shows a way to use ConfidentialClientApplication to load the token, this is fine as long as I stick to the REST API by attaching the bearer token in the header. However, I'd like to use the SDK so that I don't have to recreate all the classes to deserialize the response, plus all sorts of other data I need to get from Microsoft Graph after receiving the notification.

1 Answers
Related