I'm getting an error when trying to update an event in google calendar using the v3 api. I try this code:
$event = new Google_Event();
$event->setSymmary('TEST');
$updated = $cal->events->update("calendarID", "eventID", $event);
But I don't know why it sends me the error : Missing end time. It's necessary to insert the end time to update a existing event?
Thanks a lot!
Event must have a start time and an end time. You are creating a new event object which has neither of the two and you are trying to replace an existing event with that. I propose you first read the existing event, update the field and then do the update call. Also it should be setSummary, not setSymmary.
Here you are creating a new Event. To update an existing event, you have to:
1) Get the event:
$event = $service->events->get($calendarId, $eventId);
2) Change this event:
$event->setSummary('TEST');
3) Send this new event to replace the old:
$service->events->update($calendarId, $event->getId(), $event);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.