Leg*_*las 5 c# calendar google-calendar-api
我正在尝试获取用户默认日历Feed的"正常"网址(例如http://www.google.com/calendar/feeds/jo@gmail.com/private/full).我想使用URL的jo@gmail.com部分作为该日历的唯一ID.
我知道我可以使用网址http://www.google.com/calendar/feeds/default/private/full使用默认日历执行操作.但是,我找不到从该URL构建CalendarEntry的方法(然后我可以尝试使用SelfUri和其他一些属性来查看'普通'url是否在某处),或者将其转换为'normal'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 )
{ ... }
Run Code Online (Sandbox Code Playgroud)
但是,我找不到任何方法来知道哪些条目与默认日历相匹配.
或者任何其他方式来获取默认日历的正常URL.
小智 3
这可能不是最好的方法,但我使用它并且它有效:
feedstring = resultfeed.Entries.Item(calendarIndex).Id.AbsoluteUri.Substring(63)
postUristring = "https://www.google.com/calendar/feeds/" & feedstring & "/private/full"
Dim postUri As New Uri(postUristring)
Run Code Online (Sandbox Code Playgroud)
只需使用 calendarIndex = 0 作为默认日历。转换为 C# 应该不会太难!
| 归档时间: |
|
| 查看次数: |
5088 次 |
| 最近记录: |