简体   繁体   中英

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. 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. You need to Query again on the 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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