Php 如何在谷歌日历活动中更新与会者列表?
以下代码用于更新标题、详细信息和位置:Php 如何在谷歌日历活动中更新与会者列表?,php,api,events,calendar,Php,Api,Events,Calendar,以下代码用于更新标题、详细信息和位置: $event->setSummary($_POST['title']); $event->setDescription($_POST['detail']); $event->setLocation($_POST['location']); 以下代码用于更新日期(开始和结束): 但我正在努力更新与会者名单。 对于插入内容,如下所示: $people = $_POST['people']; // POST from other webpa
$event->setSummary($_POST['title']);
$event->setDescription($_POST['detail']);
$event->setLocation($_POST['location']);
以下代码用于更新日期(开始和结束):
但我正在努力更新与会者名单。
对于插入内容,如下所示:
$people = $_POST['people']; // POST from other webpage
$finalpeople = [];
foreach ($people as $person) {
$finalpeople[] = ['email' => $person];
}
$data['result'] = $finalpeople;
// just look at the attendees one
$event = new Google_Service_Calendar_Event(array(
'id'=> $idFinal,
'summary' => $_POST['title'],
'location' => $_POST['location'],
'description' => $_POST['detail'],
'start' => array(
'dateTime' => $startDateTime,
'timeZone' => $_POST['timezone'],
),
'end' => array(
'dateTime' => $endDateTime,
'timeZone' => $_POST['timezone'],
),
'attendees' => $data['result'],
'reminders' => array(
'useDefault' => FALSE,
'overrides' => array(
array('method' => 'email', 'minutes' => 24 * 60),
array('method' => 'popup', 'minutes' => $_POST['reminder']),
),
),
));
有没有人有更新与会者的想法?我相信你的目标如下
- 您希望使用带有PHP的googleapis更新活动中的与会者
- 您已经能够使用CalendarAPI获取和放置Google日历的值
- 使用
时,现有活动的与会者将被覆盖。所以请小心这个。因此,我建议使用一个示例事件来测试上述脚本。$newAttendes
- 您希望使用带有PHP的googleapis更新活动中的与会者
- 您已经能够使用CalendarAPI获取和放置Google日历的值
- 使用
时,现有活动的与会者将被覆盖。所以请小心这个。因此,我建议使用一个示例事件来测试上述脚本。$newAttendes
- 我相信你的目标如下
$people = $_POST['people']; // POST from other webpage
$finalpeople = [];
foreach ($people as $person) {
$finalpeople[] = ['email' => $person];
}
$data['result'] = $finalpeople;
// just look at the attendees one
$event = new Google_Service_Calendar_Event(array(
'id'=> $idFinal,
'summary' => $_POST['title'],
'location' => $_POST['location'],
'description' => $_POST['detail'],
'start' => array(
'dateTime' => $startDateTime,
'timeZone' => $_POST['timezone'],
),
'end' => array(
'dateTime' => $endDateTime,
'timeZone' => $_POST['timezone'],
),
'attendees' => $data['result'],
'reminders' => array(
'useDefault' => FALSE,
'overrides' => array(
array('method' => 'email', 'minutes' => 24 * 60),
array('method' => 'popup', 'minutes' => $_POST['reminder']),
),
),
));
$client = getClient();
$calendar = new Google_Service_Calendar($client);
$calendarId = "###"; // Please set the calendar ID.
$eventId = "###"; // Please set the event ID.
// Here, please set the new attendees.
$newAttendees = [
array(
'email' => '###',
'comment' => 'sample 1'
),
array(
'email' => '###',
'comment' => 'sample 2'
)
];
$event = new Google_Service_Calendar_Event;
$event->attendees = $newAttendees;
$result = $calendar->events->patch($calendarId, $eventId, $event);