谷歌日历api .net

时间:2013-04-03 07:04:17

标签: .net google-calendar-api

我正在使用google api 2.0 for .net。我使用此代码创建一个新日历:

CalendarEntry calendar = new CalendarEntry();
calendar.Title.Text = "Little League Schedule";
calendar.Summary.Text = "This calendar contains the practice schedule and game times.";
calendar.TimeZone =  "America/Los_Angeles";
calendar.Hidden = false;
calendar.Color = "#2952A3";
calendar.Location = new Where("", "", "Oakland");

Uri postUri = new Uri("https://www.google.com/calendar/feeds/default/owncalendars/full");
CalendarEntry createdCalendar = (CalendarEntry) service.Insert(postUri, calendar);

但是,执行时,返回错误:

执行请求失败

CalendarEntry createdCalendar =(CalendarEntry)service.Insert(postUri,calendar);

但是,如果我使用浏览器连接到Google日历,则会创建新日历。

此外,我使用此代码重新审阅所有日历,并且它正常工作

CalendarQuery query = new CalendarQuery();
query.Uri = new Uri("https://www.google.com/calendar/feeds/default/allcalendars/full");
CalendarFeed resultFeed = (CalendarFeed) service.Query(query);

有什么建议吗? 感谢

1 个答案:

答案 0 :(得分:0)

最好开始使用.net calendar API V3,因为V2已经过时,所以OAuth 1.0