May 5th, 2020

What’s new for change notifications and change tracking in Microsoft Graph – May 2020

Vincent Biret
Principal Software Developer

Change notifications uses webhooks to let applications to get notified about changes in Microsoft Graph resource data such as Outlook messages or OneDrive files. Change tracking uses delta queries to let applications discover newly created, updated, or deleted entities without performing a full read of the target resource with every request. Over the last few months, the Microsoft Graph team has delivered new capabilities to unlock new change notification and delta query scenarios for our customers.

Change notification types in SDK (preview)

We’ve added support for the notification types in the beta SDKs. Now, you don’t have to define a notification collection, a notification, and other complex types with every new project you start that takes advantage of change notifications.

This will reduce the amount of code you need to write and maintain to implement change notifications in your application. For details about how to use these new types in an app, see the NotificationControllers .NET example. Try it and let us know what you think!

Updated change notifications samples

Over the past few weeks, we have updated the aspnetcore-webhooks and nodejs-webhooks-rest samples, and added a java-spring-webhooks sample. These samples show the following:

Check out the sample in your favorite language, learn how to use change notifications, and let us know how we can improve them!

New extension in community-contributed .NET SDK

The Microsoft Graph .NET contributions SDK is a library created by the community and Microsoft jointly. These extensions to the Microsoft Graph .NET SDK can boost your productivity as a developer. Depending on your feedback, some of these extensions will become part of the official SDK.

We have added a new GetResourceSubscriptionPath extension method to IBaseRequestBuilder. This allows you to rely on the fluent API provided by the SDK instead of hard-coded strings whenever you are creating new subscriptions for the Resource property.

You can see this new method in action in the recording of the Microsoft Graph community call from March 2020.

Change tracking for new entities

v1.0

Delta query for applications and organizational contacts is now available in v1.0. You can now track changes for these entities in production apps without having to continuously poll Microsoft Graph.

Replace any existing code that continuously polls application or orgContact data by delta query to significantly improve performance.

Beta

Delta query for administrative units and oAuth2PermissionGrant is now available in beta. You can now track changes for these entities without having to continuously poll Microsoft Graph. Please note that these capabilities are still in preview. Try them out and give us feedback.

Example scenario

Suppose you’re building a native application that allows users to browse contacts. This application offers offline support, meaning that users can browse the contacts from the application when they are not connected to the internet.

Organizational contacts are centrally managed by IT, as opposed to contacts managed by an individual. Organizations can have a single copy of a person’s contact information.

Users have requested that you add support for organizational contacts to your application. Before the availability of delta query for orgContacts, this would require a complex syncing engine on the client application as well as regular polling of all organizational contacts. With delta query now available, you can support organizational contacts.

To begin change tracking, you perform an initial round of delta query to synchronize your local store of organizational contacts with the data source. At the end of that round, you save the `deltaLink` so that when the app connects online again, you can use the `deltaLink` to identify the last processed change and proceed to the next round to get any changes that have since occurred.

A deltaLink contains a token that is valid for a limited time. Using an expired deltaLink results in an error, and will require you to start a round of delta query from the beginning again.

Subscription.Read.All permission generally available

By default, GET /subscriptions returns only subscriptions created by the current application. While this satisfies the need for applications to be able to create, list, and maintain their own subscriptions, it was not satisfying for some scenarios, including administrative applications that audit subscriptions, IT pros trying to list out subscriptions with the Microsoft Graph PowerShell SDK (preview), and more. Using this new permission, applications can now list out subscriptions created by any application on Microsoft Graph.

Author

Vincent Biret
Principal Software Developer

Microsoft Graph SDKs Software Developer