Google日历活动,未设置会议详细信息

问题描述 投票:1回答:1

我正在尝试使用Java SDK V3在会议(Google Meet)上创建Google日历活动。正在创建事件,但未设置会议详细信息。不知道缺少什么

创建请求:

Calendar service = new Calendar
            .Builder(GoogleNetHttpTransport.newTrustedTransport(),
            getDefaultInstance(),
            new HttpCredentialsAdapter(googleCalendarCredentials()))
            .setApplicationName(APPLICATION_NAME)
            .build();

    Event event = new Event();

    event.setStart(new EventDateTime().setDateTime(new DateTime(currentTimeMillis())));
    event.setEnd(new EventDateTime().setDateTime(new DateTime(currentTimeMillis() + 10000000)));

    ConferenceData conferenceData = new ConferenceData();

    conferenceData.setCreateRequest(
            new CreateConferenceRequest()
                    .setConferenceSolutionKey(
                            new ConferenceSolutionKey()
                                    .setType("hangoutsMeet")));

    event.setConferenceData(conferenceData);

    service.events().insert("primary", event).execute();

获取请求:

Events events = service.events()
            .list("primary")
            .execute();

    List<Event> items = events.getItems();

    if (items.isEmpty()) {
        System.out.println("No upcoming events found.");
    } else {
        System.out.println("Upcoming events");

        for (Event eventRs : items) {
            System.out.printf("%s\n", eventRs.getConferenceData().getConferenceId());
        }
    }

将eventRs.getConferenceData()获取为空。

java google-api google-calendar-api google-api-java-client
1个回答
0
投票

如果检查Event.insert上的文档,您将看到需要设置选项参数conferenceDataVersion,以使其能够设置会议数据。

enter image description here

版本0假定不支持会议数据,并忽略事件正文中的会议数据。版本1支持复制ConferenceData

© www.soinside.com 2019 - 2024. All rights reserved.