Google Calendar的EventQuery无法检索正确的条目

Phi*_*rie 1 .net google-calendar-api gdata-api

我正在尝试使用Google的.NET Calendar API 检索南非公众假期.

我有以下问题:

  1. 某些检索到的数据超出了指定EventQuery范围.(在给定日期范围之前和之后)
  2. 某些日历条目丢失.其中一个是2011-12-25圣诞节

我通过在线查看确认了这个特定的公共日历具有正确的日期.

我最好的猜测是我错误地使用了API,并且我正在查询日历条目的创建/更新日期而不是事件日期.

码:

var feedUrl = "http://www.google.com/calendar/feeds/en.sa%23holiday%40group.v.calendar.google.com/public/full";
var service = new CalendarService("My application name");

var qry       = new EventQuery(feedUrl);
qry.StartDate = new DateTime(2011, 1, 1);
qry.EndDate   = new DateTime(2012, 1, 1);

EventFeed results = service.Query(qry);

foreach (EventEntry entry in results.Entries)
{
    if (entry.Times.Count == 0)  
       continue;

    // Using entry.Times[0].StartTime results in 
    // missing data and data outside of the given search criteria.
}
Run Code Online (Sandbox Code Playgroud)

我使用的是最新的Google .NET Data API 1.7.0.1

我究竟做错了什么?

Phi*_*rie 5

发现问题:

qry.StartDate = new DateTime(2011, 1, 1);
qry.EndDate   = new DateTime(2012, 1, 1);
Run Code Online (Sandbox Code Playgroud)

应该:

qry.StartTime = new DateTime(2011, 1, 1);
qry.EndTime   = new DateTime(2012, 1, 1);
Run Code Online (Sandbox Code Playgroud)

这解决了我在问题中提到的两个问题.(不确定为什么EventQuery类具有日期/时间属性,当只有一个集合工作时这会令人困惑).