Google日历API V3更新事件
问题描述:
我可以在https://developers.google.com/google-apps/calendar/recurringevents中描述的Google Calendar API V3中完美添加事件,但我无法确定如何开始更新事件过程。Google日历API V3更新事件
我想我必须选择事件(我有我的数据库中存储的事件ID),然后设置参数并调用更新事件。但不知道从哪里开始...
似乎很少有教程。请有任何想法吗?
答
好吧我终于得到了我自己的答案。努力阅读这些Google API资源管理器,并将其与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);
请记住,此代码需要在验证后才能运行。 希望它可以帮助别人。它做了我;)