questions

How do I get event ID from Google Calendar API?

Rate this post

Hey I’m using an API for first time, and I am confused about how to get event ID from Calendar API. Currently I’m using the sample quickstart.php file, and getting summary from this:

$results = $service->events->listEvents($calendarId, $optParams);
$events = $results->getItems();

if (empty($events)) {
    print "No upcoming events found.\n";
} else {
    print "Upcoming events:\n";
    foreach ($events as $event) {
        $start = $event->start->dateTime;
        if (empty($start)) {
            $start = $event->start->date;
        }
        printf("%s (%s)\n", $event->getSummary(), $start);
    }
}

Thanks in advance.

 

✔️Solution:

This is so simple as mention above you can fetch id by $event->ID or you can use

print_r($events) to see the data.

Leave a Reply

Your email address will not be published.

Back to top button