Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google Calendar Gdata old recurring event deleted event still showing with a EventID ending in Z

I have tried to Google this question, but have had no luck, maybe due to the search string "Z" not being specific enough.

Background:
Using Google Calendar Zend gdata library, and have been using simple code to list events for a specific time period. In this case, 27-02-2012 to 03-03-2012. I had a number of single events listed, with one recurring event, titled "Rob", mon-fri weekly.
I am using the basic code without any fancy additions. yet :)

Problem:
when I used the $query->setSingleEvents(TRUE) parameter, everything worked as expected, and showed the correct events.

When I talk about 'showing' events, im talking about the PHP page which is using Zend gdata to show calendar events.
In all situations, the Google Calendar GUI is showing the correct data (ie. The 'Rob' event is not shown, as it was deleted.

But when I set this to FALSE, the recurring event "Rob", should have start times that are meant to be grouped, but instead, a few extra random events are shown without a starttime, just the same title. Even once ive deleted the recurring event, it still shows in the data returned by gdata.

Interesting Observation
The EventID for the event that was deleted but is still shown on the page ends with "Z". It has the usual eventID followed by: _20120302T030000Z

My Question
This event was deleted in Google Calendar GUI. Why is gdata still showing an event which is deleted, and what does the eventid ending with a timestamp and Z mean.

Resolution Attempts:
1. Tried to change it from recurring event to a normal event (removing the recurrance 'for all events in series'
No luck, still extra ones listed.
2. deleted the recurring event completely for all events in series.
This showed again the correct results in SingleEvents(TRUE), but in FALSE, the old 'Rob' event is still shown, when it has completely been deleted from the calendar.

Code:

function outputCalendarByDateRange($client, $startDate='2012-02-27',
                                   $endDate='2012-03-03')
{
  $gdataCal = new Zend_Gdata_Calendar($client);
  $query = $gdataCal->newEventQuery();
  $query->setUser('default');
  $query->setVisibility('private');
  $query->setProjection('full');
  $query->setOrderby('starttime');
  $query->setStartMin($startDate);
  $query->setStartMax($endDate);
  $query->setSingleEvents(FALSE);
  $eventFeed = $gdataCal->getCalendarEventFeed($query);

  foreach ($eventFeed as $event) {
    echo "Title: " . $event->title->text . "<br />";
    echo "Event ID: " . $event->id->text . "<br />";
    foreach ($event->when as $when) {
      echo "Start: " . $when->startTime . "<br />";
    }
    echo "<br />";
  }
}
like image 693
redfox05 Avatar asked Nov 05 '22 05:11

redfox05


1 Answers

Here's what I found in the docs:

36.5.6. Deleting Events Calendar events can be deleted either by calling the calendar service's delete() method and providing the edit URL of an event or by calling an existing event's own delete() method.

In either case, the deleted event will still show up on a user's private event feed if an updateMin query parameter is provided. Deleted events can be distinguished from regular events because they will have their eventStatus property set to "http://schemas.google.com/g/2005#event.canceled".

it looks like you'll have to test for event status when you parse your feed.

BTW the timestamp breaks down to

year:2012 day:03 month:02 time:T hours:minutes:seconds 03:00:00 zulu:Z

Zulu is the same as GMT (Greenwich Mean Time) or UTC (Universal Time Code)

like image 200
RockyFord Avatar answered Nov 07 '22 22:11

RockyFord