Hello Jake,

I'll try to answer these questions one at a time:

1) Deleting a recurring event entirely:

I am able to do this with code similar to the following.  This code
creates a recurring event and then deletes it.  If you look at the
calendar UI during the process, you can see the even there and then
disappear.  Perhaps I missed an earlier post from you on this topic?
----------
CalendarEventEntry myEntry = new CalendarEventEntry();
myEntry.setTitle(new PlainTextConstruct("Test Event"));
Recurrence recur = new Recurrence();
recur.setValue(recurData);
myEntry.setRecurrence(recur);
CalendarEventEntry insertedEntry = service.insert(new
URL("http://www.google.com/calendar/feeds/"; +
"5fcmq8mrd633rulib1jgtuuk90%40group.calendar.google.com" +
"/private/full"), myEntry);
Thread.sleep(10000);
insertedEntry.delete();
------------

2) Deleting an individual occurrence of the event:

This is done in a similar fashion to how you presented it in this code,
except that you don't update the entry, you actually insert a new entry
that represents your recurrence exception entry.  So, instead of
myService.update, it's myservice.insert.  Please see the example
following this post.

3) To add an extended property to an individual occurrence of an event:

This is done in the same way you would delete an individual occurrence,
except that you add an extended property instead of setting the status
to canceled.  Please see the example following this post.

Hopefully this helps.

Cheers,

-Ryan

--------------


This code will insert a recurring event into a calendar.  It then
retrieves the first occurrence out of the feed, and either cancels this
occurrence or adds an extended property depending upon the booleans set
at the top of the method.  It then deletes the recurring event.

Note: some exceptions produce separate events which aren't deleted when
the original event is deleted.  I'm looking into this.
-----

        public static void main(String[] args) {
                boolean cancelEvent = true;
                boolean addExtProperty = false;

                try {
                        CalendarService service = new
CalendarService("CalendarTester-CancelRecurringEvent-1");
                        service.setUserCredentials("username", "password");
                         String recurData = "DTSTART;VALUE=DATE:20070102\r\n" +
                                        "DTEND;VALUE=DATE:20070103\r\n" +
                                        
"RRULE:FREQ=WEEKLY;BYDAY=Tu;UNTIL=20070904\r\n";

                        CalendarEventEntry myEntry = new CalendarEventEntry();
                        myEntry.setTitle(new PlainTextConstruct("Test Event"));
                        Recurrence recur = new Recurrence();
                        recur.setValue(recurData);
                        myEntry.setRecurrence(recur);
                        URL calendarUrl = new 
URL("http://www.google.com/calendar/feeds/"; +
                                        
"5fcmq8mrd633rulib1jgtuuk90%40group.calendar.google.com" +
                                        "/private/full" );

                        System.out.println("Inserting New Entry");

                        CalendarEventEntry insertedEntry =
service.insert(calendarUrl,myEntry);

                        CalendarEventFeed myFeed = service.getFeed(new
URL(calendarUrl.toString() +
                                        
"?singleevents=true&orderby=starttime&sortorder=ascending"),
CalendarEventFeed.class);
                        CalendarEventEntry retrievedEntry = (CalendarEventEntry)
myFeed.getEntries().get(0);

                        System.out.println("Retrieved entry: " +
retrievedEntry.getTimes().get(0).getStartTime());

                        // sleep 10 seconds
                        Thread.sleep(10000);

                        if (cancelEvent) {
                                System.out.println("Canceling retrieved 
instance");
                                
retrievedEntry.setStatus(EventEntry.EventStatus.CANCELED);
                        }
                        if (addExtProperty) {
                                System.out.println("Adding extended property");
                                ExtendedProperty extProp = new 
ExtendedProperty();
                                extProp.setName("foo");
                                extProp.setValue("bar");
                                retrievedEntry.addExtendedProperty(extProp);
                        }

                        service.insert(calendarUrl,retrievedEntry);

                        // sleep 10 seconds
                        Thread.sleep(10000);

                        System.out.println("Deleting original entry");
                        insertedEntry.delete();

                        System.out.println("Done");
                } catch (Exception ex) {
                        ex.printStackTrace();
                }
        }




On Jan 23, 9:05 am, "Jake" <[EMAIL PROTECTED]> wrote:
> I really dont think I've properly grasped how to handle repeating
> events using the java client library. As well as not being able to
> delete single occurences of events, I have just discovered that i can't
> delete the repeating event itself nor add to it an extendedproperty.
>
> In all cases I receive the following error:
>
> Service Errorcom.google.gdata.util.ResourceNotFoundException: Not Found
> <HTML>
> <HEAD>
> <TITLE>Not Found</TITLE>
> </HEAD>
> <BODY BGCOLOR="#FFFFFF" TEXT="#000000">
> <H1>Not Found</H1>
> <H2>Error 404</H2>
> </BODY>
> </HTML>
>
>                 OriginalEvent originalEvent = new OriginalEvent();
>                 myEntry.setStatus(EventEntry.EventStatus.CANCELED);
>                 originalEvent.setOriginalStartTime(when);
>                 originalEvent.setOriginalId("test");
>                 myEntry.setOriginalEvent(originalEvent);
>                 myEntry = myService.update(deleteURL, myEntry);
>
> That's my code for updating an event as "cancelled" but it throws the
> error mentioned previously.
> 
> Any help glady received. Thanks,
> 
> Jake


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Calendar Data API" group.
To post to this group, send email to 
[email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/google-calendar-help-dataapi?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to