如何使用谷歌日历API从谷歌日历中获取所有事件 [英] how to get all events from google calendar using google calendar API

查看:193
本文介绍了如何使用谷歌日历API从谷歌日历中获取所有事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

参考,我已经制作了一个获取信息的应用程序从谷歌日历事件使用谷歌API。我使用了上面URL中给出的相同代码。



现在有一个包含ME和XYZ两个日历名称的日历。如果我使用我的电子邮件ID,那么我只会收到Calendar =ME事件的详细信息。
我已经在下面的代码中使用了

  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();

如何获取所有事件详情?

nofollow>活动:列表



返回指定日历上的活动。



HTTP请求



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


您可以从文档中看到Events.list返回A日历的事件。如果您有多个日历,那么您还需要为该日历请求事件。



提示:您可能需要查看


CalendarList:list 返回用户日历列表中的条目。

这将返回用户有权访问的日历列表,然后您可以循环查看每个日历上的事件。

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?

解决方案

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.

这篇关于如何使用谷歌日历API从谷歌日历中获取所有事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆