首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用附加了Hangout Conference的Google Calendar API插入事件

使用附加了Hangout Conference的Google Calendar API插入事件
EN

Stack Overflow用户
提问于 2019-07-26 18:03:52
回答 2查看 1.4K关注 0票数 4

我想使用Google Calendar API插入一个带有Hangout Conference的活动。

我已经尝试使用conferenceData密钥,但没有结果。

这样做的正确方法是什么?

我是这样做的:

代码语言:javascript
复制
function getClient()
{
...... ......
...... ......
    return $client;
}

// Get the API client and construct the service object.
$client = getClient();
$service = new Google_Service_Calendar($client);

$conferenceDataArr = array(
    'conferenceId' => 'aaa-bbb-ccc',
    'conferenceSolution' => array(
        'key' => array(
            'type' => 'hangoutsMeet'
        ),
        'name' => 'Reunión en VideoConferencia',

    ),
    'entryPoints' => array(
        'accessCode' => '55555',
        'entryPointType' => 'video',
        'label' => 'meet.google.com/aaa-bbbb-ccc',
        'uri' => 'https://meet.google.com/aaa-bbbb-ccc'
    )
);

$event = new Google_Service_Calendar_Event(array(
    'summary' => 'Google I/O 2015',
    'location' => '800 Howard St., San Francisco, CA 94103',
    'description' => 'A chance to hear more about Google\'s developer products.',
    'start' => array(
      'dateTime' => '2019-07-26T11:54:00',
      'timeZone' => 'Europe/Madrid',
    ),
    'end' => array(
      'dateTime' => '2019-07-26T20:00:00',
      'timeZone' => 'Europe/Madrid',
    ),
    'attendees' => array(
      array('email' => 'me@gmail.com'),
    ),
    'reminders' => array(
      'useDefault' => FALSE,
      'overrides' => array(
        array('method' => 'email', 'minutes' => 0)
      ),
    ),
    'conferenceData' => $conferenceDataArr
  ));

  $calendarId = 'primary';

  $optParams = Array(
    'sendNotifications' => true,
    'sendUpdates' => 'all',
    );

  $event = $service->events->insert($calendarId, $event, $optParams);
  printf('Event created: %s\n', $event->htmlLink);
  printf('Hangout link: %s\n', $event->hangoutLink);
EN

回答 2

Stack Overflow用户

发布于 2020-04-02 04:08:46

我也发现自己在无休止的寻找和尝试。我几乎用立即工作的NodeJS应用编程接口修改了我的用例。

这就是我让它工作的方式:首先,您需要执行insert方法,然后您可以使用patch方法添加会议。

下面是我的工作示例:

代码语言:javascript
复制
$event = new \Google_Service_Calendar_Event(array(
    'summary' => 'Appointment',
    'location' => 'Earth',
    'description' => 'Hello world',
    'start' => array(
        'dateTime' => Carbon::now()->format('c'),
        'timeZone' => 'Europe/Zurich',
    ),
    'end' => array(
        'dateTime' => Carbon::now()->addMinutes(15)->format('c'),
        'timeZone' => 'Europe/Zurich',
    )
));

$calendarId = 'primary';
$event = $service->events->insert($calendarId, $event);

printf('Event created: %s', $event->htmlLink);

$conference = new \Google_Service_Calendar_ConferenceData();
$conferenceRequest = new \Google_Service_Calendar_CreateConferenceRequest();
$conferenceRequest->setRequestId('randomString123');
$conference->setCreateRequest($conferenceRequest);
$event->setConferenceData($conference);

// ['conferenceDataVersion' => 1] is required!
$event = $service->events->patch($calendarId, $event->id, $event, ['conferenceDataVersion' => 1]);

printf('<br>Conference created: %s', $event->hangoutLink);

希望它也适用于你。

票数 3
EN

Stack Overflow用户

发布于 2020-04-01 10:51:09

我使用的是JavaScript而不是the APIs are the same。我必须在insert()中设置conferenceDataVersion,并在conferenceData中使用createRequest,如下所示:

代码语言:javascript
复制
conferenceData: {
  createRequest: {
    requestId: '123456790',
    conferenceSolutionKey: {
      type: 'hangoutsMeet',
    },
    status: {
      statusCode: 'success'
    }
  },
}
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/57217719

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档