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 ran开发者_JAVA技巧ge. 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.
精彩评论