我正在嘗試將某個事件添加到Google日曆中的特定日曆,而我只是沒有找到如何。這是我的代碼:使用GData API向「特定」Google日曆添加事件
CalendarService service = new CalendarService("MyTEst");
service.setUserCredentials("Username", "Password");
EventEntry entry = new EventEntry();
// Set the title and content of the entry.
entry.Title.Text = "title";
entry.Content.Content = "test";
// Set a location for the event.
Where eventLocation = new Where();
eventLocation.ValueString = "Location";
entry.Locations.Add(eventLocation);
When eventTime = new When(DateTime.now, DateTime.now.AddDays(2));
entry.Times.Add(eventTime);
Uri postUri = new Uri("http://www.google.com/calendar/feeds/default/private/full");
// Send the request and receive the response
AtomEntry insertedEntry = service.Insert(postUri, entry);
任何人都可以幫我解決這個問題嗎?
編輯
也許我應該提到這fonctionnability僅僅是一個網站的管理員,其想要伊斯利添加會合,並注意自己的谷歌日曆,讓我automaticaly與「硬編碼」認證的可訪問值,所以我確信用戶名和密碼都可以。
非常感謝DanJo519。我現在就試試這個! – 2010-01-27 21:22:05
我試過了,它仍然失敗成爲一個錯誤;執行請求失敗:google.com/calendar/feeds/[email protected]/private-PRIVATE_KEY/full。我不明白。我已經在最後嘗試了「全部」或「基本」(基本是從谷歌默認提供的,但我已經嘗試過,因爲太完美了,所以你說了這樣的話)。無論如何,沒有人工作:( – 2010-01-27 22:01:03
我已經做了修改我的答案是,你實際上不需要包含-PRIVATE_KEY,如果刪除了,你可以發佈,假設你在日曆上有寫權限,我已經用我的一個輔助日曆成功測試過了。 – 2010-01-29 15:39:01