Hi,

I am trying to access entries of a non-default calendar using ZF's Gdata
element (ZF 1.10.6) with no luck.

I can access the calendars and the entries of the default calendar using the
code provided in
http://framework.zend.com/manual/en/zend.gdata.calendar.html.

$service = Zend_Gdata_Calendar::AUTH_SERVICE_NAME;
$user = "[email protected]";
$pass = "mypassword";

// Create an authenticated HTTP client
$client = Zend_Gdata_ClientLogin::getHttpClient($user, $pass, $service);

// Create an instance of the Calendar service
$service = new Zend_Gdata_Calendar($client);

try
{
    $listFeed= $service->getCalendarListFeed();
}
catch (Zend_Gdata_App_Exception $e)
{
    echo "Error: " . $e->getMessage();
}

echo "<h1>Calendar List Feed</h1>";
echo "<ul>";
foreach ($listFeed as $calendar) {
    echo "<li>" . $calendar->title .
         " (Event Feed: " . $calendar->id . ")</li>";
}
echo "</ul>";

So what do I have to do with the code below to use any other calendar (from
the same authenticated user)?

$query = $service->newEventQuery();
$query->setUser('default');
// Set to $query->setVisibility('private-magicCookieValue') if using
// MagicCookie auth
$query->setVisibility('private');
$query->setProjection('full');
$query->setOrderby('starttime');
$query->setFutureevents('true');

// Retrieve the event list from the calendar server
try {
    $eventFeed = $service->getCalendarEventFeed($query);
} catch (Zend_Gdata_App_Exception $e) {
    echo "Error: " . $e->getMessage();
}

// Iterate through the list of events, outputting them as an HTML list
echo "<ul>";
foreach ($eventFeed as $event) {
    echo "<li>" . $event->title . " (Event ID: " . $event->id . ")</li>";
}
echo "</ul>";

Reply via email to