J'ai un compte Google et il y a trois calendriers Google dans ma liste de calendrier. J'essaie de créer un événement avec Google Agenda sélectionné. J'utilise php.créer un événement sur google calendar sélectionné sur le même compte
here is list of google calendars.
+----------------------+-----------------------------------------------+
| calName | calid |
+----------------------+-----------------------------------------------+
| [email protected] | [email protected] |
| Contacts | #[email protected] |
| Holidays in India | en.indian#[email protected] |
+----------------------+-----------------------------------------------+
[email protected] est un calendrier "primary
". Lorsque je crée un événement dans ce calendrier, l'événement est créé avec succès en utilisant PHP.
Toutefois, lorsque j'essaie de créer un événement dans les agendas "Contacts, Holidays in India
", il ne crée jamais d'événement utilisant PHP pour ces agendas.
Mon code:
$event = new Google_Service_Calendar_Event(array(
'summary' => $eventname,
'location' => $address,
'description' => $description,
'start' => array(
'dateTime' => $s,
'timeZone' => $timezone,
),
'end' => array(
'dateTime' => $e,
'timeZone' => $timezone,
),
'attendees' => array(
array('email' => $contactemail),
),
'reminders' => array(
'useDefault' => FALSE,
'overrides' => array(
array('method' => 'email', 'minutes' => 24 * 60),
array('method' => 'popup', 'minutes' => 10),
),
),
));
$calid = 'en.indian#[email protected]'; // this is static for now
$event = $service->events->insert($calid, $event);
Erreur:
Fatal error: Uncaught exception 'Google_Service_Exception' with message 'Error calling POST https://www.googleapis.com/calendar/v3/calendars/en.indian%23holiday%40group.v.calendar.google.com/events : (403) Forbidden' in /var/www/myinvitebig.com/vendor/google/apiclient/src/Google /Http/REST.php:110 Stack trace: #0 /var/www/myinvitebig.com/vendor/google/apiclient/src/Google/Http/REST.php(62): Google_Http_REST::decodeHttpResponse(Object(Google_Http_Request), Object(Google_Client)) #1 [internal function]: Google_Http_REST::doExecute(Object(Google_Client), Object(Google_Http_Request)) #2 /var/www/myinvitebig.com/vendor/google/apiclient/src/Google/Task/Runner.php(174): call_user_func_array(Array, Array) #3 /var/www/myinvitebig.com/vendor/google/apiclient/src/Google/Http/REST.php(46): Google_Task_Runner->run() #4 /var/www/myinvitebig.com/vendor/google/apiclient/src/Google/Client.php(593): Google_Http_REST::execute(Object(Google_Client), Object(Google_Http_Request)) #5 /var/www/myinvitebig.com/vendor/google/apiclient/src/Google/Ser in /var/www/myinvitebig.com/vendor/google/apiclient/src/Google/Http/REST.php on line 110