简体   繁体   中英

not able to add meet link to google calendar events in java

I am working on a spring boot api which schedules events for me but and its working fine but along with events I want to add a meet link too and I am not able to do that.I am using a service account from cloud console and shared my personal account with this service account.How can I implement google meet?

Here's my code:

Event event = new Event()
                    .setSummary("Google I/O 2015")
                    .setLocation("800 Howard St., San Francisco, CA 94103")
                    .setDescription("A chance to hear more about Google's developer products.");
            ConferenceSolutionKey conferenceSKey = new ConferenceSolutionKey();
            conferenceSKey.setType("hangoutsMeet");
            CreateConferenceRequest createConferenceReq = new CreateConferenceRequest();
            createConferenceReq.setRequestId("adojajaod"); // ID generated by you

            createConferenceReq.setConferenceSolutionKey(conferenceSKey);
            ConferenceData conferenceData = new ConferenceData();
            conferenceData.setCreateRequest(createConferenceReq);

            System.out.println(conferenceData);
            event.setConferenceData(conferenceData);


            DateTime startDateTime = new DateTime("2021-08-14T09:00:00-07:00");
            EventDateTime start = new EventDateTime()
                    .setDateTime(startDateTime)
                    .setTimeZone("America/Los_Angeles");
            event.setStart(start);

            DateTime endDateTime = new DateTime("2021-08-15T17:00:00-07:00");
            EventDateTime end = new EventDateTime()
                    .setDateTime(endDateTime)
                    .setTimeZone("America/Los_Angeles");
            event.setEnd(end);

            String[] recurrence = new String[]{"RRULE:FREQ=DAILY;COUNT=2"};
            event.setRecurrence(Arrays.asList(recurrence));

            EventReminder[] reminderOverrides = new EventReminder[]{
                    new EventReminder().setMethod("email").setMinutes(24 * 60),
                    new EventReminder().setMethod("popup").setMinutes(10),
            };
            Event.Reminders reminders = new Event.Reminders()
                    .setUseDefault(false)
                    .setOverrides(Arrays.asList(reminderOverrides));
            event.setReminders(reminders);

            
            event = client.events().insert("himanshuranjan30@gmail.com", event).setConferenceDataVersion(1).execute();
            System.out.printf("Event created: %s\n", event.getHtmlLink());

Here I am trying to setup a meet link using conference but its not working and giving a error like:

{
  "code" : 400,
  "errors" : [ {
    "domain" : "global",
    "message" : "Invalid conference type value.",
    "reason" : "invalid"
  } ],
  "message" : "Invalid conference type value."
}

Any help will be appreciated.

conferenceSKey.setType("hangoutsMeet");

Looks like the calendar where you try to insert the event does not accept the "hangoutsMeet" conference call type.

To verify use get of Calendar API to view your target Calendar metadata. https://developers.google.com/calendar/api/v3/reference/calendars

You can see the allowed types under,

"conferenceProperties": {
    "allowedConferenceSolutionTypes": [
      string
    ]
  }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM