简体   繁体   English

如何使用Google Calendar API从Google Calendar获取所有事件

[英]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. 参照此,我制作了一个应用程序,该应用程序使用Google API从Google日历事件中获取信息。 I have used the same code given in above URL. 我使用了上面URL中给出的相同代码。

Now there is one calendar with 2 calendar name like ME and XYZ. 现在有一个带有2个日历名称的日历,例如ME和XYZ。 If I use my email Id then I only got the details of event with Calendar = "ME". 如果我使用我的电子邮件ID,那么我只会得到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? 如何获取所有事件详细信息?

Events: list 活动:清单

Returns events on the specified calendar. 返回指定日历上的事件。

HTTP request HTTP请求

GET https://www.googleapis.com/calendar/v3/calendars/calendarId/events 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. 从文档Events.list中可以看到,该事件返回A日历的事件。 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. CalendarList:列表返回用户日历列表中的条目。

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. 这将返回用户有权访问的日历的列表,然后您可以循环浏览每个日历上的事件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM