Google Calendar API:如何获取默认日历的 CalendarEntry?
我正在尝试获取用户默认日历源的“正常”网址(例如 http://www.google.com/calendar/feeds/[电子邮件受保护]/private/full)。我想使用网址的 [email protected] 部分作为该日历的唯一 ID。
我知道我可以使用 URL http://www 对默认日历执行操作.google.com/calendar/feeds/default/private/full。但是,我找不到从该 URL 构造 CalendarEntry 的方法(然后我可以尝试 SelfUri 和其他一些属性来查看“正常”url 是否在某处),或者将其转换为“正常”url以任何方式。
我知道我可以像这样获取日历列表:
CalendarQuery query_cal = new CalendarQuery();
query_cal.Uri = new Uri( "http://www.google.com/calendar/feeds/default/allcalendars/full" );
CalendarFeed resultFeed = (CalendarFeed) service.Query( query_cal );
foreach ( CalendarEntry entry in resultFeed.Entries )
{ ... }
但是,我找不到任何方法来知道哪些条目与默认日历匹配。
或任何其他方式获取默认日历的正常 URL。
I'm trying to get the 'normal' url for a users default calendar feed (e.g. http://www.google.com/calendar/feeds/[email protected]/private/full). I would like to use the [email protected] part of the URL as a unique ID for that calendar.
I know I can do things with the default calendar using the URL http://www.google.com/calendar/feeds/default/private/full. However, I can't find a way to construct a CalendarEntry from that URL (I could then try SelfUri and some other properties to see if the 'normal' url is in there somewhere), or to convert it to the 'normal' url in any way.
And I know I can get the list of Calendars like this:
CalendarQuery query_cal = new CalendarQuery();
query_cal.Uri = new Uri( "http://www.google.com/calendar/feeds/default/allcalendars/full" );
CalendarFeed resultFeed = (CalendarFeed) service.Query( query_cal );
foreach ( CalendarEntry entry in resultFeed.Entries )
{ ... }
However, I can't find any way to know which of those entries matches the default calendar.
Or any other way to get that normal url for the default calendar.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这可能不是最好的方法,但我使用它并且它有效:
只需将 calendarIndex = 0 用于默认日历。转换为 C# 应该不会太难!
It's probably not the best method, but I use this and it works:
Just use calendarIndex = 0 for the default calendar. Shouldn't be too hard to convert to C#!
太感谢了!效果非常好!这是我的最终代码:
Thank you SO much! That works perfectly! Here is my final code: