Pritesh Chhunchha
Pritesh Chhunchha

Reputation: 179

how to get all events from google calendar using google calendar API

With reference of this I have made a application which gets information from google calendar event using google api. I have used the same code given in above URL.

Now there is one calendar with 2 calendar name like ME and XYZ. If I use my email Id then I only got the details of event with Calendar = "ME". I have used below code

            EventsResource.ListRequest request = service.Events.List("primary");
            request.TimeMin = dtStart;
            request.TimeMax = dtEnd;
            request.ShowDeleted = false;
            request.SingleEvents = true;
            request.OrderBy = EventsResource.ListRequest.OrderByEnum.StartTime;
            Events events = request.Execute();

How to get all the events details?

Upvotes: 1

Views: 20314

Answers (1)

Linda Lawton - DaImTo
Linda Lawton - DaImTo

Reputation: 117281

Events: list

Returns events on the specified calendar.

HTTP request

GET https://www.googleapis.com/calendar/v3/calendars/calendarId/events

As you can see from the documentation Events.list returns the events for A calendar. If you have more then one calendar then you will need to request the events for that calendar as well.

Tip: You might want to look at

CalendarList: list Returns entries on the user's calendar list.

This will return a list of the calendars the user has access to then you can loop though the events on each one of them.

Upvotes: 1

Related Questions