How can I insert a new Event for non primary Calendar? Using python gdata
Question
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')
This write to primary Calendar. How can i write/InsertEvent to my "foo" calendar?
Thanks!
Solution
Ok, i found the url in a_calendar.content.src it show like "http://www.google.com/calendar/feeds/"+id+"/private/full"
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
OTHER TIPS
Try specifying a different URL for InsertEvent. See the docs on retrieving calendars or just try hitting the listed URL with a GET. Use a retrieved calendar's URL instead of '/calendar/feeds/default/private/full' in the InsertEvent call.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow