Btw, It's weird that I can get it work with google apps lib v.1.24.0.
Could anyone please try to use v.1.29 or higher and see if its
working?

Thanks.

On Feb 13, 4:45 pm, JavaDecaf <[email protected]> wrote:
> This is very strange, I used your exact code with just the change of
> username and password. But it still doesn't work. I'm copying the
> google apps lib right from v.1.29.0 lib folder.
>
> This is the exception I've gotten by running your code above:
>
> Exception in thread "main"
> com.google.gdata.util.ServiceForbiddenException: Forbidden
> If-Match or If-None-Match header required
>
>         at com.google.gdata.client.http.HttpGDataRequest.handleErrorResponse
> (HttpGDataRequest.java:505)
>         at com.google.gdata.client.http.GoogleGDataRequest.handleErrorResponse
> (GoogleGDataRequest.java:555)
>         at com.google.gdata.client.http.HttpGDataRequest.checkResponse
> (HttpGDataRequest.java:480)
>         at com.google.gdata.client.http.HttpGDataRequest.execute
> (HttpGDataRequest.java:459)
>         at com.google.gdata.client.http.GoogleGDataRequest.execute
> (GoogleGDataRequest.java:527)
>         at com.google.gdata.client.Service.delete(Service.java:1501)
>         at com.google.gdata.client.GoogleService.delete(GoogleService.java:
> 652)
>         at com.google.gdata.client.Service.delete(Service.java:1463)
>         at com.google.gdata.client.GoogleService.delete(GoogleService.java:
> 660)
>         at com.google.gdata.client.Service.delete(Service.java:1463)
>         at com.google.gdata.client.GoogleService.delete(GoogleService.java:
> 637)
>         at sg.com.ncs.mware.connector.google.GCalendarController.main
> (GCalendarController.java:325)
>
> Strangely the insert works perfectly but the delete just won't work. I
> even tried the batch operation to delete. It just told me the page has
> moved to https page...
>
> On Feb 12, 10:00 am, Trevor Johns <[email protected]> wrote:
>
> > On Wed, Feb 4, 2009 at 2:04 AM, JavaDecaf <[email protected]> wrote:
>
> > > Hi, I was trying to perform a very simple delete calendar event. But
> > > it gave me a Forbidden message. Below is the snipped code that I was
> > > using:
>
> > > CalendarService cs = new CalendarService(AppsConst.APPS_NAME);
> > > URL deleteUrl = new URL(event.getGEvent().getEditLink().getHref());
> > > cs.delete(deleteUrl);
>
> > > Exception thrown:
>
> > > Caused by: com.google.gdata.util.ServiceForbiddenException: Forbidden
> > > If-Match or If-None-Match header required
>
> > >        at 
> > > com.google.gdata.client.http.HttpGDataRequest.handleErrorResponse
> > > (HttpGDataRequest.java:505)
> > >        at 
> > > com.google.gdata.client.http.GoogleGDataRequest.handleErrorResponse
> > > (GoogleGDataRequest.java:555)
> > >        at com.google.gdata.client.http.HttpGDataRequest.checkResponse
> > > (HttpGDataRequest.java:480)
> > >        at com.google.gdata.client.http.HttpGDataRequest.execute
> > > (HttpGDataRequest.java:459)
> > >        at com.google.gdata.client.http.GoogleGDataRequest.execute
> > > (GoogleGDataRequest.java:527)
> > >        at com.google.gdata.client.Service.delete(Service.java:1501)
> > >        at com.google.gdata.client.GoogleService.delete(GoogleService.java:
> > > 652)
> > >        at com.google.gdata.client.Service.delete(Service.java:1463)
> > >        at com.google.gdata.client.GoogleService.delete(GoogleService.java:
> > > 660)
> > >        at com.google.gdata.client.Service.delete(Service.java:1463)
> > >        at com.google.gdata.client.GoogleService.delete(GoogleService.java:
> > > 637)
>
> > > The closest clue that I can get is from:
> > >http://code.google.com/p/gdata-java-client/issues/detail?id=92. It
> > > looks very similar to my problem. I wonder if it was fixed.
>
> > > Please help =(
>
> > JavaDecaf,
> > Can you make sure that you're using the latest version of theJava
> > client library?
>
> > The following code worked for me:
>
> >         // Create service instance
> >         CalendarService service = new 
> > CalendarService("net.tjohns.scratchpad");
> >         service.setUserCredentials("[email protected]", "secretPassword");
>
> >         // Prepare event
> >         URL postUrl = new
> > URL("http://www.google.com/calendar/feeds/default/private/full";);
> >         CalendarEventEntry myEntry = new CalendarEventEntry();
>
> >         myEntry.setTitle(new PlainTextConstruct("This Shoudln't Exist!"));
> >         myEntry.setContent(new PlainTextConstruct("This event should be 
> > deleted. :)"));
>
> >         DateTime startTime = 
> > DateTime.parseDateTime("2009-02-11T15:00:00-08:00");
> >         DateTime endTime = 
> > DateTime.parseDateTime("2009-02-11T17:00:00-08:00");
> >         When eventTimes = new When();
> >         eventTimes.setStartTime(startTime);
> >         eventTimes.setEndTime(endTime);
> >         myEntry.addTime(eventTimes);
>
> >         // Send the request and receive the response:
> >         CalendarEventEntry insertedEntry = service.insert(postUrl, myEntry);
>
> >         // Delete the event!
> >         service.delete(new URL(insertedEntry.getEditLink().getHref()));
>
> > --
> > Trevor Johns
>
>

--~--~---------~--~----~------------~-------~--~----~
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