Thanks you .. i can update all events but i can't update events for
monthly recurring events
i'm getting following error while using this code
The code is :
GoogleService myService = new GoogleService("cl","exampleCo-
exampleApp-1");
myService.setUserCredentials([email protected],password);
URL postURL = new URL("http://www.google.com/calendar/feeds/
[email protected]/private/full");
Query myQuery = new Query(postURL);
myQuery.setFullTextQuery(title);
CalendarEventFeed myResultsFeed = myService.query
(myQuery,CalendarEventFeed.class);
Iterator iterFeed = myResultsFeed.getEntries().iterator();
CalendarEventEntry myEvent = (CalendarEventEntry) iterFeed.next();
myEvent.setTitle(new PlainTextConstruct(title));
myEvent.setContent(new PlainTextConstruct(content));
Person author = new Person("Texflow", null,userId);
myEvent.getAuthors().add(author);
myEvent.addLocation(new Where("","",location));
String participants []={"[email protected]"};
if(participants !=null && !(participants.equals("")) ) {
EventWho []guest = new EventWho[participants.length];
for(int i=0;i<participants.length;i++) {
guest[i] = new EventWho();
guest[i].setEmail(participants[i]);
myEvent.addParticipant(guest[i]);
}
myEvent.setSendEventNotifications(true);
}
//Create DateTime events and create a When object to hold them,
then
add
//the When event to the event
String recurData = "DTSTART;VALUE=DATE:20091001\r\n"
+ "DTEND;VALUE=DATE:20091002\r\n"
+ "RRULE:FREQ=MONTHLY;BYDAY=1Tu;UNTIL=20100904\r\n";
Recurrence recur = new Recurrence();
recur.setValue(recurData);
myEvent.setRecurrence(recur);
myEvent.update();
while using above code i'm getting following error
com.google.gdata.util.InvalidEntryException: Bad Request
[Line 3, Column 78, element entry] Duplicate extension element
http://schemas.google.com/g/2005:recurrence
at
com.google.gdata.client.http.HttpGDataRequest.handleErrorResponse
(HttpGDataRequest.java:502)
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.update(Service.java:1422)
at com.google.gdata.client.Service.update(Service.java:1377)
at com.google.gdata.client.GoogleService.update
(GoogleService.java:544)
at com.google.gdata.data.BaseEntry.update(BaseEntry.java:599)
On Oct 16, 12:23 pm, florent devin <[email protected]> wrote:
> If this is a new a entry you may use :
> EventEntry inserted = myService.insert(URL, theEntry);
>
> if you want to update you have to get the entry and then use the update
> function like this :
> CalendarEventFeed theResultFeed = myServie.query(theQuery,
> CalendarEventFeed.class);
> // then select the one you want for example
> Iterator iterFeed = theResultFeed.getEntries().iterator();
> CalendarEventEntry theEntry = (CalendarEventEntry) iterFeed.next;
> // and then modify what you want
> // .../...
> // and then
> theEntry.update();
>
> Hope this help
> Regards
>
> 2009/10/16 Thamilselvi <[email protected]>
>
>
>
>
>
> > Hi ..
> > how to update particular events in my application using google
> > calendar api in java
>
> > i tried to update using following code in java
>
> > GoogleService myService = new GoogleService("cl","exampleCo-
> > exampleApp-1");
> > myService.setUserCredentials(userId,password);
>
> > URL postURL = new URL("http://www.google.com/calendar/feeds/
> > [email protected]/private/full");
>
> > CalendarEventEntry myEvent = new CalendarEventEntry();
> > myEvent.setTitle(new PlainTextConstruct("New Tile "));
> > myEvent.setContent(new PlainTextConstruct(content));
> > Person author = new Person("Sample", null,[email protected]);
> > myEvent.getAuthors().add(author);
> > myEvent.addLocation(new Where("","","Sample, Chennai"))
>
> > String recurData = "DTSTART;VALUE=DATE:20091001\r\n"
> > + "DTEND;VALUE=DATE:20091002\r\n"
> > + "RRULE:FREQ=WEEKLY;BYDAY=Tu;UNTIL=20100904\r\n";
>
> > Recurrence recur = new Recurrence();
> > recur.setValue(recurData);
> > myEvent.setRecurrence(recur);
> > CalendarEventEntry updateEntry = myService.update(postURL,myEvent);
>
> --
> Florent Devin
> Téléphonez moi gratuitement via le net :
> Domicile :http://call.mylivio.com/fd0
> Professionnel :http://call.mylivio.com/fd_pro
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---