简体   繁体   English

谷歌日历 api 不返回经常性事件

[英]google calendar api not returning recurring events

I'm trying to pull a list of events from my Google Calendar based on a date range, most of which are recurring events.我正在尝试根据日期范围从我的 Google 日历中提取事件列表,其中大部分是重复事件。 The following code returns events that were entered during the date range, but not recurrences that happen during that date range.以下代码返回在日期范围内输入的事件,但不返回在该日期范围内发生的重复事件。 Any idea what I'm doing wrong?知道我做错了什么吗?

EventQuery eventQuery = new EventQuery(calendarUri);
eventQuery.SingleEvents = true;
eventQuery.StartDate = startDate;
eventQuery.EndDate = endDate;
EventFeed resultsFeed = calendarService.Query(eventQuery);

Be aware that Query returns only 25 Entries + NextChunk is there are more.请注意,查询仅返回 25 个条目 + NextChunk 是否还有更多。 You need to Query again on the NextChunk.您需要在 NextChunk 上再次查询。

EventFeed calFeed = service.Query(query) as EventFeed;

// now populate the calendar
while (calFeed != null && calFeed.Entries.Count > 0)
{
    // look for the one with dinner time...
    foreach (EventEntry entry in calFeed.Entries)
    {
        this.entryList.Add(entry); 
        if (entry.Times.Count > 0)
        {
            foreach (When w in entry.Times) 
            {
                dates.Add(w.StartTime); 
            }
        }
    }
    // just query the same query again.
    if (calFeed.NextChunk != null)
    {
        query.Uri = new Uri(calFeed.NextChunk); 
        calFeed = service.Query(query) as EventFeed;
    }
    else
        calFeed = null;
}

Further: When contains an Number of entries on recurring events.进一步:何时包含有关重复事件的条目数。 Need to look for the right one.需要寻找合适的。

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

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