开发者

Does anyone know how to get Zend_Gdata_Calendar to fetch events for secondary calendars?

开发者 https://www.devze.com 2023-01-21 02:39 出处:网络
I have got as far as using ClientLogin to log in to the Google Account, I can retrieve a list of the calendar names for this user (using the example code on the Dev Guide).

I have got as far as using ClientLogin to log in to the Google Account, I can retrieve a list of the calendar names for this user (using the example code on the Dev Guide).

This is great. However, when I demand a list of events (again using Google's example code) only the events for the primary calendar are returned.

If it is the case that it is only possible to access primary calendar events using the API then so be it, but I am sure I am just mi开发者_C百科sunderstanding something!

If anyone's used this API and can tell me anything I would be very grateful.

Thank you my friends.


It's actually quite simple. All you need to do is specify the URL when requesting an event feed.

Using the example code to get the list of calendars:

$gdataCal = new Zend_Gdata_Calendar($login);
$calFeed = $gdataCal->getCalendarListFeed();

Loop through grabbing the URLs of each calendar, which you will use to request a specific event feed:

foreach ($calFeed as $calendar) {
    $url = $calendar->link[0]->href;
    $query = $gdataCal->newEventQuery($url);
    $eventFeed = $gdataCal->getCalendarEventFeed($query);
}
0

精彩评论

暂无评论...
验证码 换一张
取 消