Reading Calendar Events from Office 365 using Graph API and C#

Outlook calendar is part of the Outlook messaging hub in Office 365 that also lets you manage emails and contacts, find information about users in an organization, initiate online conversations, share files, and collaborate in groups. Microsoft Graph is the gateway to data and intelligence in Microsoft 365. It provides a unified programmability model that you can use to access the tremendous amount of data in Office 365, Windows 10, and Enterprise Mobility + Security.

The Microsoft Graph API offers a single endpoint, https://graph.microsoft.com, to provide access to rich, people-centric data and insights exposed as resources of Microsoft 365 services. You can use REST APIs or SDKs to access the endpoint and build apps that support scenarios spanning across productivity, collaboration, education, security, identity, access, device management, and much more.

Reading a events from an Office 365 user using Graph API

Initially an application needs to be registered with Azure. Once logged in go to App registration and new App registration.

Required permissions need to be set from the API permissions. For this example the permissions are set as below.

From certificates and secret tab, generate a secret. Note down the App ID, Tenant ID and Secret.

In Visual Studio, create a console application using C#

Upon running the application the calendar events from the users calendar’s will be displayed.

Please follow and like us: