2011-11-03 89 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; 
} 
相關問題