Access a shared calendar (such as a meeting room via Office 365 REST API)
Asked Answered
S

2

5

I'm using the Office 365 REST api to access my account's calendars. I'd like to access all the calendars my account has access to, in particular the meeting rooms calendars appearing in the "Other calendars" section in my Office 365 interface.

For now, if I query the "https://outlook.office365.com/api/v1.0/me/calendars" endpoint, I only got the calendars I own, not the meeting rooms calendars.

Any clue on how to get them (via Office 365 REST API) ?

Stillbirth answered 25/6, 2015 at 16:22 Comment(0)
F
3

The REST API doesn't support access to other user's calendars when logging in as a user. You can use the client credentials model to grant the app access to all calendars in the organization and access them that way.

Flurry answered 26/6, 2015 at 14:37 Comment(1)
Link is broken, so here u go: blogs.msdn.com/b/exchangedev/archive/2015/01/21/…Lynda
S
1

I've been able to do what I believe you're asking about (using the office 365 API to get the events from calendars which have been shared with your outlook calendar) by using the following endpoint:

.../api/v2.0/Users('PRIMARY_USER_ID')/Calendars('SHARED_CALENDAR_ID')/Events

I'm not sure if this endpoint would get you access to ones you have partial access to, but you should be able to grab events/info from any calendar that has been directly shared with your outlook/office 365 account.

  • The PRIMARY_USER_ID (just what I'm calling it here) comes back to you as part of the response object when you first sign in with your outlook account and go through Microsoft's auth process. This isn't the ID of the calendar you're trying to access, but the idea of the primary calendar (the one you can find at the api/v2.0/me endpoint) that the other calendars are shared with. All of the IDs I've seen have come back in the form of a bunch of letters and numbers separated by dashes.

  • The CALENDAR_ID is the ID of the shared calendar you're trying to get the events from. You can see these IDs for each of your shared calendars if you make a request to .../api/v2.0/me/calendars/. This will return each of the calendars that are shared with you, info about the owner, and the 'ID' of that calendar.

If you plug in those ids, and make a request to url above, you should be able to get calendar events back from the API.

Slack answered 24/5, 2017 at 17:9 Comment(1)
For those using Microsoft Graph API v1.0, it's https://graph.microsoft.com/v1.0/users/me/calendars/{calendar_id}/eventsHackamore

© 2022 - 2024 — McMap. All rights reserved.