2011-11-03 106 views
0

是否可以从特定日历获取特定事件?GData日历获取特定事件

我收集日历中的所有事件,在设备上保存一些事件,然后需要检测源日历中此事件的任何更改。所以我需要一些方法通过它的id从谷歌日历中获取事件数据。 etag什么的。

有没有办法做到这一点不收集完整的事件集?

非常感谢!

回答

0

下面是我用什么:

# Gets the event with id $eventId from the calendar $calendar 
function get_event_by_id_ex($gdataCal, $eventId, $calendar='default'){ 
if(!isset($eventId)) 
{ 
    throw new Exception(INCORRECT_EVENT_ID); 
} 

try 
{ 
    $query = $gdataCal->newEventQuery(); 
    $query->setUser($calendar); 
    $query->setVisibility('private'); 
    $query->setProjection('full'); 
    $query->setEvent($eventId); 

    $ctz = 'Europe/Lisbon'; 
    $query->setParam('ctz', $ctz);  

    $eventEntry = $gdataCal->getCalendarEventEntry($query); 
} 
catch (Zend_Gdata_App_Exception $e) 
{ //var_dump($e); //DBUG 
    throw new Exception(ERROR_ACCESSING_APPOINTMENT . ' (' .$eventId. ')'); 
} 

return $eventEntry; 
} 
相关问题