Como faço para recuperar todos os eventos atualizados recentemente no Google Calendar?

StackOverflow https://stackoverflow.com/questions/1291458

  •  18-09-2019
  •  | 
  •  

Pergunta

Atualmente, estou trabalhando em um recurso de sincronização do Google Calendar, que deve sincronizar com nosso próprio aplicativo de calendário e com o aplicativo do Google Calendar. Agora, preciso identificar as mudanças recentes no calendário do Google para que eu possa copiar esses eventos em nosso aplicativo de calendário. Eu uso o Zend gdata, no entanto, qualquer idéia que eu apreciaria.

Foi útil?

Solução

(Modificado de http://framework.zend.com/manual/en/zend.gdata.calendar.html)

$query = $service->newEventQuery();
$query->setUser('default');
$query->setVisibility('private');
$query->setProjection('full');
$query->setOrderby('starttime');
$query->setFutureevents('true');

// Subtract time frame for when you want to detect
// updated events, for example, in the past 24 hrs
$refresh = time() - 60*60*24;
$refresh_date = date('Y-m-dTH:i:sP', $refresh);

$query->setUpdatedMin($refresh_date);


// 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>";
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top