我正在尝试更新我现有的google calender事件。
虽然更新事件我也想更新时区。
所以在更新时区时出现此错误。
string(517) "{
"error": {
"errors": [
{
"domain": "global",
"reason": "invalidParameter",
"message": "Value 'emailaddress@gmail.com' in content does not agree with value 'primary'. This can happen when a value set through a parameter is inconsistent with a value set in the request."
}
],
"code": 400,
"message": "Value 'emailaddress@gmail.com' in content does not agree with value 'primary'. This can happen when a value set through a parameter is inconsistent with a value set in the request."
}
}"
此代码用于更新时区。
$event_id = 'event id';
$service = new Google_Service_Calendar($client);
$event = $service->events->get('primary', $event_id);
/* Updating timezone (**This is causing issue**) */
$calendar = $service->calendars->get('primary');
$calendar->setTimeZone('Europe/Amsterdam');
$updatedCalendar = $service->calendars->update('primary', $calendar);
$event->setSummary($clientName); // Summery of calender
$event->setDescription($treatmentname); // Description of calender
/* Update start time */
$startTime = '2018-11-01T08:00:00';
$start = new Google_Service_Calendar_EventDateTime();
$start->setDateTime($startTime);
$event->setStart($start);
/* Update end time */
$endTime = '2018-11-01T09:00:00';
$end = new Google_Service_Calendar_EventDateTime();
$end->setDateTime($endTime);
$event->setEnd($end);
/* set single event not recurring */
$event->setSingleEvent(true);
$updatedEvent = $service->events->update('primary', $event->getId(), $event);