I have been recently tasked to query calendar detail using API from Office 365 but not to expose any private meeting details. For this situation I thought to make use of Outlook Rest API 2.0.

I will explain step by steps, how to create an app, which will only query calendar invite in the context of logged in user.

Prerequisites :

  • Register an App in Office 365.
    • Configure permission for ‘Office 365 Exchange Online’ and only select these 2 under ‘Delegate Permissions
      • Read user and shared calendars.
      • Read user calendars

data1.jpg

  • Must have a regular user mailbox to query other user’s calendar detail.
  • Use PostMan or any other such tools to query and then you can automate the process using powershell as well.

Validate Permission:

You should use Outlook REST API 2.0 to fetch details and here are steps to query in postman.

Click on ‘Request Token’ and use your Office 365 credentials, once prompted click allow to have access on calendar

  • If successful, you will be presented to ‘use token’ option.
  • Now you can put these details in GET Section to retrieve data through GRAPH API, you can use many more combination using Outlook Rest API 2.0

Retrieve Calendar Details

Since you were able to retrieve token, now you can use such urls to post query to office 365 to retrieve calendar details:

https://outlook.office.com/api/v2.0/users/<usermailboxemailaddress>/calendarview?startDateTime=2018-11-26T01:00:00&endDateTime=2018-11-26T23:00:00&$select=Subject

calendarquery

Thank you for reading !

Advertisement