2009-12-28 39 views
3
def addEvent(calendar_service): 
    event = gdata.calendar.CalendarEventEntry() 
    event.content = atom.Content(text='Tennis with John 30.12.2009 15:00-16:00') 
    event.quick_add = gdata.calendar.QuickAdd(value='true') 
    new_event = calendar_service.InsertEvent(event, '/calendar/feeds/default/private/full') 

寫入主日曆。我如何寫/ InsertEvent到我的「富」日曆?
謝謝!如何爲非主日曆插入新事件?使用python gdata

回答

3

好吧,我發現這個網址a_calendar.content.src顯示它像 「http://www.google.com/calendar/feeds/ 」+ ID +「/私營/全」

def addEvent(calendar_service): 
    event = gdata.calendar.CalendarEventEntry() 
    event.content = atom.Content(text='Tennis with John 30.12.2009 15:00-16:00') 
    event.quick_add = gdata.calendar.QuickAdd(value='true') 
    feed = calendar_service.GetOwnCalendarsFeed() 
    calurl=[a_calendar.content.src for i, a_calendar in enumerate(feed.entry)] 
    new_event = calendar_service.InsertEvent(event, calurl[1]) #calurl[1] select the 2. cal of own's cals 
0

嘗試爲InsertEvent指定一個不同的URL。請參閱retrieving calendars上的文檔或嘗試使用GET命中列出的URL。在InsertEvent調用中使用檢索日曆的URL而不是'/ calendar/feeds/default/private/full'。


相關問題