开发者

google calendar api not returning recurring events

开发者 https://www.devze.com 2023-03-17 08:48 出处:网络
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 n

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号