views:

49

answers:

2

I have worked out how to add a reminder after setting a CalendarEventEntry using

insertedEntry = myService.insert( postUrl, myEntry )
reminder = new Reminder()
reminder.setMethod( Reminder$Method.ALERT )
//foo
insertedEntry.getReminder().add( reminder )
insertedEntry.update()

but if you update it becomes an EventEntry and the getReminder returns null and whatever you do it wipes all reminders

insertedEntry = myService.update(editUrl, myEntry)

can find nothing in the api or docs about this case.

Anyone solved this already??

+1  A: 

Did you try to cast the update result ?

BaseEntry updateEntry = myService.update(editUrl, myEntry)
if (updatedEntry instanceOf CalendarEventEntry) {
    insertEntry = (CalendarEventEntry) updatedEntry
}
Eric Darchis
i fixed this by doing the update() the immediately running a query on it, and then you have to add the reminder to the query. REALY coutner intuitive...
john renfrew
<code> EventEntry editEntry = myService.update(editUrl, myEntry) result = editEntry.getSelfLink().getHref() myQuery = new CalendarQuery(postUrl) CalendarEventFeed evFeed = myService.query( myQuery, CalendarEventFeed.class ) CalendarEventEntry calEntry = evFeed.getEntries().get(0)</code>
john renfrew
A: 

Can't you simply update it with:

insertedEntry.update()

rather than

insertedEntry = myService.update(editUrl, myEntry)
tim_yates