I have tried to create a recurring event with the code below and it
fails in the browser with no hint at what caused the failure.
Debugging indicates that the error is occurring when I set the
recurrence. I have successfully created single events with similar
code as shown further below. What am I doing wrong with the
recurrence? (P.S. the recurrence string was extracted from a feed
that I manually created in the Calendar, so I'm pretty sure it's
correct).
Any help is most appreciated!
TIA
Bob
========CODE FOR RECURRING EVENT (THIS FAILS)========
<?php
require_once 'Zend/Loader.php';
Zend_Loader::loadClass('Zend_Gdata');
Zend_Loader::loadClass('Zend_Gdata_ClientLogin');
Zend_Loader::loadClass('Zend_Gdata_Calendar');
$usr = '[email protected]';
$pwd = 'pwd';
$svc = Zend_Gdata_Calendar::AUTH_SERVICE_NAME;
$client = Zend_Gdata_ClientLogin::getHttpClient($usr, $pwd, $svc);
createRecurringEvent($client);
function createRecurringEvent($client)
{
$gdataCal = new Zend_Gdata_Calendar($client);
$event = $gdataCal->newEventEntry();
$event->title = $gdataCal->newTitle("MyEvent");
$event->where = array($gdataCal->newWhere('RC Center'));
$event->content = $gdataCal->newContent('Mens Encounter');
$recurrence =
"DTSTART;VALUE:DATE:20090206\r\n" .
"DTEND;VALUE:DATE:20090207\r\n" .
"RRULE:FREQ=WEEKLY;BYDAY=FR;UNTIL=20090904;WKST=SU\r\n" .
"BEGIN:VTIMEZONE\r\n" .
"TZID:America/New_York\r\n" .
"X-LIC-LOCATION:America/New_York\r\n" .
"BEGIN:DAYLIGHT\r\n" .
"TZOFFSETFROM:-0500\r\n" .
"TZOFFSETTO:-0400\r\n" .
"TZNAME:EDT\r\n" .
"DTSTART:19700308T020000\r\n" .
"RRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=2SU\r\n" .
"END:DAYLIGHT\r\n" .
"BEGIN:STANDARD\r\n" .
"TZOFFSETFROM:-0400\r\n" .
"TZOFFSETTO:-0500\r\n" .
"TZNAME:EST\r\n" .
"DTSTART:19701101T020000\r\n" .
"RRULE:FREQ=YEARLY;BYMONTH=11;BYDAY=1SU\r\n" .
"END:STANDARD\r\n" .
"END:VTIMEZONE\r\n";
$event->recurrence = $gdataCal->newRecurrence($recurrence);
$newEvent = $gdataCal->insertEvent($event);
}
?>
========CODE FOR SINGLE EVENT (THIS WORKS)========
<?php
require_once 'Zend/Loader.php';
Zend_Loader::loadClass('Zend_Gdata');
Zend_Loader::loadClass('Zend_Gdata_ClientLogin');
Zend_Loader::loadClass('Zend_Gdata_Calendar');
$usr = '[email protected]';
$pwd = 'pwd';
$svc = Zend_Gdata_Calendar::AUTH_SERVICE_NAME;
$client = Zend_Gdata_ClientLogin::getHttpClient($usr, $pwd, $svc);
createSingleEvent($client);
function createSingleEvent($client)
{
$gdataCal = new Zend_Gdata_Calendar($client);
$event = $gdataCal->newEventEntry();
$event->title = $gdataCal->newTitle("MyEvent");
$event->where = array($gdataCal->newWhere('My Center'));
$event->content = $gdataCal->newContent('My Meeting');
$startDate = "2009-02-24";
$startTime = "06:15";
$endDate = "2009-02-24";
$endTime = "07:45";
$tzOffset = "-05";
$when = $gdataCal->newWhen();
$when->startTime = "{$startDate}T{$startTime}:00.000{$tzOffset}:00";
$when->endTime = "{$endDate}T{$endTime}:00.000{$tzOffset}:00";
$event->when = array($when);
$newEvent = $gdataCal->insertEvent($event);
}
?>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Calendar Data API" group.
To post to this group, send email to
[email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/google-calendar-help-dataapi?hl=en
-~----------~----~----~----~------~----~------~--~---