简体   繁体   English

无法在 Java 中将会议链接添加到谷歌日历事件

[英]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?我正在开发一个 spring boot api,它为我安排事件,但它工作正常,但与事件一起,我也想添加一个会议链接,但我无法做到这一点。我正在使用来自云控制台的服务帐户并共享我使用此服务帐户的个人帐户。如何实施 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.看起来您尝试插入事件的日历不接受“hangoutsMeet”电话会议类型。

To verify use get of Calendar API to view your target Calendar metadata.要验证使用日历 API 的获取来查看您的目标日历元数据。 https://developers.google.com/calendar/api/v3/reference/calendars https://developers.google.com/calendar/api/v3/reference/calendars

You can see the allowed types under,您可以在下面看到允许的类型,

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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