2010-11-12 142 views
2

我想用Google Calendar添加派對活動,所以我添加了一個新日曆「events」。是否有刪除該日曆中的所有事件的功能?Google日曆(API)問題

還是隻有刪除整個日曆並重新創建它纔可能?

我每天更新離線數據,所以我認爲最好的方法是刷新整個Google日曆日曆,並簡單地上傳所有事件。

回答

2

這有幫助:Google Calendar .NET API documentation

// Create a CalenderService and authenticate 
CalendarService myService = new CalendarService("exampleCo-exampleApp-1"); 
myService.setUserCredentials("[email protected]", "mypassword"); 

// Create the query object: 
EventQuery query = new EventQuery(); 
query.Uri = new Uri("https://www.google.com/calendar/feeds/[calendar]/private/full"); 

其中[日曆] = 「[email protected]」 爲默認日曆或在例如,你的 '事件' 日曆(在Gmail日曆找到)的ID,即,https://開頭www.google.com/calendar/[calendarID]/private/full「

// Tell the service to query: 
EventFeed calFeed = myService .Query(query); 

// This should delete all items in your calendar 

foreach(var item in calFeed.Entries) { 
    entry.Delete(); 
} 
+0

鏈接已損壞。 – StillLearnin 2015-11-12 15:37:34