2013-04-03 501 views
0

我正在使用google api 2.0 for .net。我用這個代碼創建一個新的日曆:谷歌日曆api .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,日曆);

但是,如果我使用瀏覽器連接到Google日曆,則會創建新日曆。

另外,我使用此代碼retriving所有日曆和它的工作原理

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

任何建議? 謝謝

回答

0

最好你開始使用.net日曆API V3,因爲V2已經過時,所以是OAuth 1.0