在Google Calender api(V3)中指定日期的所有活动列表? [英] All Event listing on specified date in Google Calender api (V3) in java?

查看:289
本文介绍了在Google Calender api(V3)中指定日期的所有活动列表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想要做的是在给定的谷歌日历中获取给定日期的所有活动。

what I want to do is get all the events in a given google calendar for a given date.

现在我们可以获得使用以下代码非常容易地列出事件

Now we can get the event listing pretty easily using the following code

 public Events getAllEvent()
{
    Events events= null ;
    try {

        events = service.events().list(this.calendarID).execute();

    } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }

    return events ;
}

我应该如何转换此功能,以便它只在当天发送事件我指定的。我尝试了很多方法,但是在版本3中它不像在v2中那样工作。
任何建议。请记住,我们正在谈论谷歌日历Api版本3

How should I convert this function so that it will give only event on that day which i specify. I tried a lot of way but in version 3 it's not working the way it use to in v2. Any suggestion. Please Remeber that we are talking about google calender Api version 3.

推荐答案

您好我找到了我的问题的答案,所以在这里为其他人更新。
这可以做到。虽然我们没有直接的方法,但我们可以使用查询参数来完成它。如果我们想要从今天开始并且不早于今天开始提供活动。然后我们就可以做到这一点。

Hi ya i found the answer to my ques so updating here for others. This can be done. Though we do not have direct way we can do it using query parameter. Let say if we wanted events feed from today onwards and not earlier than today. Then we can do this.

Events events = service.events().list(calendarID).setTimeMin("2012-01-01T00:00:00Z").execute();

而不是

 events = service.events().list(this.calendarID).execute();

这些只是给我们所有的信息,直到2031年。

which just give us all the feeds from way back till 2031.

为了在日期之间获取Feed,请同时使用setTimemin和setTimeMax

For getting feeds in between dates use setTimemin and setTimeMax together

希望这有助于有人欢呼...

Hope this help someone cheers...

这篇关于在Google Calender api(V3)中指定日期的所有活动列表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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