Search code examples
c#outlookuwpoffice365apioffice365-restapi

Access multiple Office 365 Outlook calendars within organization in UWP using OAuth2.0?


My organization currently uses Office365, and I am creating a Universal Windows Platform app that essentially needs to access the calendars of multiple accounts within the organization. I am currently using the Office365 Rest API, and already can successfully query a single account's calendar data, after getting an OAuth2.0 access token for a particular user.

After searching through multiple resources and existing Stackoverflow questions, I have tried the following with no luck to get multiple user account calendars without having to sign in to each account individually:

  • Performing a GET request with the graph API from Microsoft Graph API
  • Performing a GET request using navigation paths to users calendars using this method and other variations. (Returns 403 access denied error)

I also found a possible solution by using EWS Managed API, but I was unsure of its compatibility with UWP and our current Office 365 setup.

Lastly, I looked into building daemon or service apps, but this method seemed really unnecessary and possibly impossible with the current configuration of Azure. It requires asymmetric key crypt. set up within the system, and re-configuring the app as a whole within Azure.

Any help is appreciated.

[EDIT]: FYI all of the calendars have been made public, and can be viewed in the web client of Outlook.


Solution

  • I found to what I think is the only solution with today's version of UWP and the Office365 REST Api.

    First I started up a different application that was compatible with the EWS Managed API and made a query to the Microsoft Exchange server that my organization is using. I tracked this request using Fiddler, the http debugger, to view the actual request and response. This way, I could find the exact endpoint of my exchange server.

    Then, I navigated to the exchange service's URL in my browser, and saved the service's WSDL file, and imported it as a service reference to my UWP solution.

    Finally, I set up a Httpclient, and generated a request to match all of the properties of the request made from the successful EWS Managed API call that I tracked in Fiddler.