0
我在Google日曆中使用Google API PHP客戶端。更新和事件開始/結束時間Google日曆,v3 api
我現在有問題創建事件,但是當我嘗試更新日期時間開始/結束呼叫失敗,事件未更新。
我已成功更新摘要,但無法更新開始/結束時間。
private function _update_google_event($eventId = '', $updateData = array())
{
if(strlen($eventId) == 0 || empty($updateData)) return false;
$calendar = $this->_get_gcal();
//First get the event
$event = $calendar->events->get($this->calendar_id, $eventId);
var_dump($event->getId());
if(isset($updateData['summary'])) {
$event->setSummary($updateData['summary']);
}
if(isset($updateData['location'])) {
$event->setLocation($updateData['location']);
}
var_dump($event->getEnd());
/*
if(isset($updateData['start'])) {
$start = new Google_Service_Calendar_EventDateTime();
$start->setDateTime($updateData['start']);
$event->setStart($start);
}
*/
if(isset($updateData['end'])) {
var_dump(new Google_EventDateTime());
$end = new Google_Service_Calendar_EventDateTime();
var_dump($end->setDateTime($updateData['end']));
$end->setDateTime($updateData['end']);
var_dump($event->setEnd($end));
}
//Update Sequence
$event->setSequence($event->getSequence() + 1);
echo "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n";
//var_dump($event);
//Send the update request
//$updatedEvent = new Google_Service_Calendar_Event($calendar->events->update($this->calendar_id, $event->getId(), $event));
$updatedEvent = $calendar->events->update($this->calendar_id, $event->getId(), $event);
echo $updatedEvent->getUpdated();
return false;
}
我看到的更新該提到的需要更新的序列號事件的一些堆棧溢出的問題,所以我已經這樣做了,但它不會改變的開始/結束時間任何東西。
任何提示/指針將不勝感激。 如果有任何其他細節可以幫助,請只問。
謝謝!