Reputation: 3
I use google-api-php-client-v3 to connect my application to Google Calendar and create/delete events. When I try to create recurring events, it seems that the Recurrence rule is not recognized by Google.
$event = new Google_Service_Calendar_Event();
$event->setSummary($session->summary);
$event->setLocation($session->location);
$start_date = new Zend_Date($session->date_debut . ' ' . $session->start_date);
$end_date = new Zend_Date($session->date_fin . ' ' . $session->end_date);
$start = new Google_Service_Calendar_EventDateTime();
$start->setDateTime($start_date->get(Zend_Date::RFC_3339));
$start->setTimeZone('America/Montreal');
$event->setStart($start);
$end = new Google_Service_Calendar_EventDatetime();
$end->setDateTime($end_date->get(Zend_Date::RFC_3339));
$end->setTimeZone('America/Montreal');
$event->setEnd($end);
$event->setRecurrence(array('RRULE:FREQ=DAILY;COUNT=6;INTERVAL=1;'));
In the event properties, the Repeat property indicates:
This recurrence rule can not Be edited in Google Calendar. Click Cancel to keep current rule . Edit rule and click Done to override current rule .
In an event created directly in Calendar if I apply the same Recurrence rule, it is recognized!
Repeat: Daily 6 times
What I'm missing?
Thanks for any help!
Upvotes: 0
Views: 714
Reputation: 12671
This behavior seems to be caused by the trailing semicolon. Using the string 'RRULE:FREQ=DAILY;COUNT=6;INTERVAL=1'
allows the recurrence to be editable in the Google Calendar UI.
Upvotes: 0