bdev03
bdev03

Reputation: 425

How to get calendar ID for an event when making Get Event call?

On creating a new event in a user's calendar, I receive a push notification that contains the id of the newly created event. In order to get more details about this event, I make the Get Event call:

https://learn.microsoft.com/en-us/graph/api/event-get?view=graph-rest-1.0

This returns all the event details for that particular event, but it does not seem to be returning the id of the calendar in which the event was created. I need it to attach this event to existing calendar in my local cache.

I have looked at the API spec but do not see calendar id field anywhere.

I would like to get an idea on how to get calendar id after making a get event call.

Upvotes: 3

Views: 2587

Answers (1)

Vadim Gremyachev
Vadim Gremyachev

Reputation: 59318

There is a relationship of Event resource with Calendar resource and Microsoft Graph lets you query relationships of one resource with another via expand parameter.

In case of Event resource its properties along with associated Calendar properties within a single query could be requested like this:

GET https://graph.microsoft.com/v1.0/me/events/{event-id}/?$expand=calendar

The response will contain among another properties the Id of Calendar

References

Use query parameters to customize responses

Upvotes: 3

Related Questions