Dhaval Patel
Dhaval Patel

Reputation: 648

Google Calendar API - Unable to set Event Organizer

I am using Google Calendar JAVA API. I am able to create an Event with 'hangoutsMeet' option successfully.

Problem : I am not able to set Organizer with API Request.

Default : By Default API Key owner ( From the G Suit account API key has been authorized ) is a Organizer.

If I do not able to set Organizer using API, entire solution of creating Google Event with 'Hangout Meet' video option will not work, as without organizer who will approve the Participant.

I have use following code, however it seems not working. Do I missing anything ?

    CreateConferenceRequest createRequest = new CreateConferenceRequest();
    ConferenceSolutionKey conferenceSolutionKey_ = new ConferenceSolutionKey();
    conferenceSolutionKey_.setType("hangoutsMeet");

    createRequest.setConferenceSolutionKey(conferenceSolutionKey_);
    createRequest.setRequestId(UUID.randomUUID().toString());

    EventAttendee[] attendees = new EventAttendee[] {
            new EventAttendee().setEmail("[email protected]"),
            new EventAttendee().setEmail("[email protected]"),
            new EventAttendee().setEmail("[email protected]"),
        };

    Organizer organizer = new Organizer();
    organizer.setDisplayName("XYZ");
    organizer.setEmail("[email protected]");
    organizer.setSelf(false);
    event_.setOrganizer(organizer);

Upvotes: 1

Views: 1447

Answers (1)

Alessandro
Alessandro

Reputation: 2998

In order to set an organizer who is not the creator itself, you will have to transfer the event to the new organizer's calendar. As you can read in the docs:

To change the organizer, use the move operation. Read-only, except when importing an event.

To do so in Java you can use this method:

Event updateEvent = service.events().move(yourCalendarId, event_.getId(), "[email protected]").execute();

Be sure you have the permission to edit the new organizer's event.

References:

Event move()

Upvotes: 1

Related Questions