Office 365 API or Azure AD Graph API - Get Someone Elses Calendar
Asked Answered
H

2

3

I am trying to get an office 365 calendar, not for "me", but of a contact. i.e. in the company I work for (which has a global address list), I want to access Dave's calendar, as I would in outlook.

I have been through the documentation here, StackOverflow (e.g. here and here), plus Office 365 samples and Graph API samples (I believe Graph API is required for global address lists), but cannot find a way to do it.

I have 3 questions:

  1. Is this possible?
  2. If so, how please?
  3. If it's not possible with a global address list, is it possible with contacts created via Office 365 - and if so, how?

Any help much appreciated.

Hennebery answered 22/7, 2015 at 19:51 Comment(0)
P
3

It isn't currently possible if I understand your scenario correctly. If you are signing in as you, you only get access to your mailbox. You don't get access to other people, even if they've delegated access to you. This is something we're looking to improve upon, but for now you cannot do it.

You can create an app that uses the client credential auth flow, and an admin can grant access to all users, but I don't think that's the scenario you're going for.

Pelligrini answered 22/7, 2015 at 20:22 Comment(0)
R
3

To start, yes this is possible, but you will need to use an App-Only token to access the Exchange APIs to get this data. It is important to remember that your access token for the API dictates what permissions you have to access that API. Assuming you are not an Admin, if you get a User token and try to query someone else's calander, you will get a "403 - Forbidden" since you only have the permissions to read your own calendar.

On the other hand, you can request for your application to have Application Permissions (versus Delegated Permssions) which will give you high level access to query the Exchange API without the context of a signed-in user. You can see documentation on these permissions here at Table 4.

Note that for any application that requests these level of permissions, it will require admin consent before the app will be able to get access. From the same page as above:

Note The tables describing service app permissions do not include a Requires admin consent column, as permissions for service apps always require admin consent. For more information about service apps, see Building service and daemon apps in Office 365.

Please check out the link in that quote, as it may really help you get started with developing a service application.

I hope that this helps!

Regorge answered 22/7, 2015 at 20:31 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.