我想使用Google Calendar API插入一个带有Hangout Conference的活动。
我已经尝试使用conferenceData密钥,但没有结果。
这样做的正确方法是什么?
我是这样做的:
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);发布于 2020-04-02 04:08:46
我也发现自己在无休止的寻找和尝试。我几乎用立即工作的NodeJS应用编程接口修改了我的用例。
这就是我让它工作的方式:首先,您需要执行insert方法,然后您可以使用patch方法添加会议。
下面是我的工作示例:
$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);希望它也适用于你。
发布于 2020-04-01 10:51:09
我使用的是JavaScript而不是the APIs are the same。我必须在insert()中设置conferenceDataVersion,并在conferenceData中使用createRequest,如下所示:
conferenceData: {
createRequest: {
requestId: '123456790',
conferenceSolutionKey: {
type: 'hangoutsMeet',
},
status: {
statusCode: 'success'
}
},
}https://stackoverflow.com/questions/57217719
复制相似问题