我从12月11日到12月20日使用Google-calendar-api创建了一个重复系列。我在12月18日使用“仅此事件”选项对单个实例进行了更改(例如:描述)。
然后,我将在12月15日编辑标题,然后选择“此及后续”选项。这会在12月18日(更改描述的地方)重置我的异常,以匹配12月15日的描述。
如Google API文档中所述,在将父系列分为“ this and following”分为两个时,如何保留该系列的例外。
编辑:要创建Google定期活动:
$event = new Google_Service_Calendar_Event([
'summary' => $meeting->title,
'location' => $meeting->location,
'start' => [
'date' => $all_day_startdate,
'dateTime' => $start_date_time,
'timeZone' => $timezone
],
'end' => [
'date' => $all_day_enddate,
'dateTime' => $end_date_time,
'timeZone' => $timezone
],
'conferenceData' => $conference_link,
]);
$event>setRecurrence(array(format_recurrence_rule_for_google($recurrence_pattern)));
// set Google calendar event parameters.
$calendar_id = 'primary';
$opt_params = [
'sendNotifications' => $send_invite,
'conferenceDataVersion' => 1
];
// create the Google calendar event
$event = $service->events->insert($calendar_id, $event, $opt_params);
要更新单个实例:
$event = new Google_Service_Calendar_Event([
'summary' => $meeting->title,
'location' => $meeting->location,
'start' => [
'date' => $all_day_startdate,
'dateTime' => $start_date_time,
'timeZone' => $meet_creator->timezone
],
'end' => [
'date' => $all_day_enddate,
'dateTime' => $end_date_time,
'timeZone' => $meet_creator->timezone
],
"recurringEventId" => $recurring_event_id,
"originalStartTime" => [
"dateTime" => $exist_event->getOriginalStartTime()->getDateTime(),
"timeZone" => $meet_creator->timezone
],
"iCalUID" => $exist_event->getiCalUID(),
'conferenceData' => event_conference($meeting->conference)
]);
$opt_params = [
'conferenceDataVersion' => ($generate_conf || $cancel_conf) ? 1 : 0
];
$calendar_id = 'primary';
$updatedEvent = $service->events->insert($calendar_id, $event, $opt_params);
此及后续事件代码段
$current_event = $this->get_instance_with_event_id($parent_meeting);
$rec = format_recurrence_rule_for_google($parent_meeting->meeting_options->recurrence);
$current_event->setRecurrence(array($rec));
// trim the parent recurring event into two
$service->events->update('primary', $parent_meeting->meeting_options->recurring_event_id, $current_event);
$event = $this->create_initial_calendar_event() // which is the first snippet to create recurring event
这不可能
官方文档说明了如何使用重复事件。它的一节显示了如何修改以下所有实例,但是按照这些步骤,你将两个分开Recurring Events
,并且exception instances
将消失。只有一种方法可以修改an的某些参数,instance
并将其应用于此事件和后续事件,并且使用的网络版本Calendar
(它也尊重异常)。
循环播放
更新并插入(在此处查看官方文档)
获取,修补和插入(可以处理一些异常)
Recurring Event
与它的所有信息。instances
具有的事件exceptions
。正文请求是Event资源,可以通过两种方式进行定义:
start
,end
并recurrence
。使用将patch
维护所有其他参数。get
。对于你的情况,你需要修改start.dateTime
,end.dateTime
直到12月15日(和相应的小时数)以及要更改的新参数,例如description
。exceptions
。在Event resource
该步骤中使用与原始的克隆Recurring Event
。有一些属性需要更改:iCalUID = ""
,id = ""
和(针对你的情况recurrence
)以便于12月15日停止。Recurring Events
并需要三个不同的API调用。将exceptions
只保留一个Recurring Event
。取消实例,插入新事件