谷歌日历 API V3 更新事件


Google calendar API V3 update event

我可以按照 https://developers.google.com/google-apps/calendar/recurringevents 中所述使用 Google 日历 API V3 完美地添加事件,但我无法弄清楚如何开始更新事件过程。

我想我必须选择事件(我的数据库中确实存储了事件 ID),然后设置参数并调用更新事件。但是不知道从哪里开始...

周围似乎很少有教程。有什么想法吗?

好吧,

我终于得到了答案。努力阅读那些Google API Explorer并将它们与google-api-php-client匹配。无论如何,这是一个更新描述、摘要和事件颜色的简单代码。

$apiClient = new apiClient();
$apiClient->setUseObjects(true);
$service   = new apiCalendarService($apiClient);
$events    = $service->events;
$currEvent  = $events->get("primary", $event_id);
$currEvent->setDescription("YOUR FULL DESCRIPTION");
$currEvent->setSummary("YOUR DESIRED SUMMARY - Kind of title");
$currEvent->setColorId(2); // One of the available colors ID
$recurringEvent = $events->update('primary', $event_id, $currEvent);

请记住,此代码仅在身份验证后才需要运行。希望它对某人有所帮助。它让我;)