Search code examples
pythoneventsgoogle-calendar-apirecurring

How to move a recurring event to an other calendar in Python using Google Calendar API?


I'm not able with the use of the function .move() in Google Calendar API to move an instance of a recurring event to an other calendar... Any Idea ?

My code :

def eventmover(calendarId, eventId, destination, login):
    service = build('calendar', 'v3', credentials=login)        
    service.events().instances().move(calendarId=calendarId,eventId=eventId, destination=destination).execute()

Returned error:

json returned "Cannot change the organizer of an instance.">


Solution

  • You are doing the move on the instance of the event, not on the event itself. They are both methods of the Event class, you can't use them together. You should do:

    def eventmover(calendarId, eventId, destination, login):
        service = build('calendar', 'v3', credentials=login)        
        service.events().move(calendarId=calendarId,eventId=eventId, destination=destination).execute()