从Google日历中检索条目

时间:2014-01-30 16:54:24

标签: c# calendar google-calendar-api gdata gdata-api

我正在开发一个从Google日历中检索事件的功能。我根据发现here的教程实现了它 该功能确实有效,但最多只能检索25个事件,我想知道我是否遗漏了什么。

这是我的功能

void retrieveEvents() 
{
    EventQuery query = new EventQuery();
    CalendarService service = new CalendarService("MyTest");
    service.setUserCredentials("email", "password");
    service.QueryClientLoginToken();

    query.Uri = new Uri("http://www.google.com/calendar/feeds/USER-ID/private/full");

    query.StartTime = new DateTime(2010, 1, 1);
    query.EndTime = DateTime.Now;

    EventFeed calfeed = service.Query(query);

    foreach (EventEntry ee in calfeed.Entries) 
    {
        ListViewItem lvi = new ListViewItem(ee.Title.Text + "\r\n");
        listEvents.Items.Add(lvi);
    }
}

1 个答案:

答案 0 :(得分:1)

首先,不推荐使用v2。您真的应该将代码移到使用API​​的v3。

来自FAQ

如何在事件Feed中检索超过25个结果?

您可以使用查询参数max-results来检索超过默认值25的内容。如果要检索Feed中的所有事件,请将max-results参数设置为一个非常大的数字。您还可以利用下一个链接来浏览事件,这些链接可用作Feed的子元素。

相关问题