[Python] Remove resource from event where caller is not the organizer using Google Calendar...

Discussão em 'Python' iniciado por Stack, Maio 22, 2025.

  1. Stack

    Stack Membro Participativo

    I'm trying to remove resources (conference rooms) that have declined events. It works as expected for events where the caller is the event organizer, but not if another person is the organizer. The event is modifiable and I can manually remove the room using the Google Calendar web interface.

    This is the code using the Python google-api-client (v2.169.0):

    service = build("calendar", "v3", credentials=<CREDS>)
    event = service.events().get(calendarId="primary", eventId=event_id).execute
    new_attendees = [
    a
    for a in event.get("attendees", [])
    if not (a.get("resource") and a.get("responseStatus") == "declined")
    ]
    event["attendees"] = new_attendees
    service.events().update(calendarId="primary", eventId=event_id, body=event, sendUpdates="none").execute()


    What am I doing wrong here?

    Continue reading...

Compartilhe esta Página