Google 日历的 EventQuery 未检索到正确的条目
我正在尝试使用检索南非公共假期a href="http://code.google.com/apis/calendar/data/2.0/developers_guide_dotnet.html" rel="nofollow">Google 的 .NET 日历 API。
我遇到以下问题:
- 某些检索到的数据超出了指定的
EventQuery
范围。 (给定日期范围之前和之后) - 某些日历条目丢失。其中之一是 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.
}
我正在使用最新的可用Google .NET Data API 1.7.0.1
我做错了什么?
I am trying to retrieve South African public holidays using Google's .NET Calendar API.
I have the following issues:
- Some of the retrieved data is outside of the specified
EventQuery
range. (Both before and after the given date range) - Some of the calendar entries are missing. One of them being Christmas 2011-12-25
I verified that this particular public calendar has the correct dates by viewing it online.
My best guess is that I am using the API incorrectly and that I am querying something like the calendar entry's created/updated date instead of the event date.
Code:
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.
}
I am using the latest available Google .NET Data API 1.7.0.1
What am I doing wrong?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
发现问题:
应该是:
这解决了我的问题中提到的两个问题。 (不知道为什么
EventQuery
类同时具有日期/时间属性,当只有一组起作用时,这会令人困惑)。Found the issue:
should be:
This solves both of my issues mentioned in my question. (Not sure why the
EventQuery
class has both Date/Time properties, this is confusing when only the one set works).