【发布时间】:2016-01-29 04:45:13
【问题描述】:
我成功地通过 php api 客户端将事件添加到谷歌日历,但我想要的是让该事件每年重复一次,例如公司周年纪念日等,我在谷歌文档中也没有找到,那又如何应在创建重复事件时添加
【问题讨论】:
-
有文档,请看这里:link
标签: php api google-calendar-api google-api-php-client
我成功地通过 php api 客户端将事件添加到谷歌日历,但我想要的是让该事件每年重复一次,例如公司周年纪念日等,我在谷歌文档中也没有找到,那又如何应在创建重复事件时添加
【问题讨论】:
标签: php api google-calendar-api google-api-php-client
There is documentation for recurring event
$event = new Google_Service_Calendar_Event();
$event->setSummary('Appointment');
$event->setLocation('Somewhere');
$start = new Google_Service_Calendar_EventDateTime();
$start->setDateTime('2011-06-03T10:00:00.000-07:00');
$start->setTimeZone('America/Los_Angeles');
$event->setStart($start);
$end = new Google_Service_Calendar_EventDateTime();
$end->setDateTime('2011-06-03T10:25:00.000-07:00');
$end->setTimeZone('America/Los_Angeles');
$event->setEnd($end);
$event->setRecurrence(array('RRULE:FREQ=YEARLY;UNTIL=20110701T170000Z'));
$attendee1 = new Google_Service_Calendar_EventAttendee();
$attendee1->setEmail('attendeeEmail');
// ...
$attendees = array($attendee1,
// ...
);
$event->attendees = $attendees;
$recurringEvent = $service->events->insert('primary', $event);
echo $recurringEvent->getId();
【讨论】: