Hi!
I'm a young java user, and I need some help to finish a project.
I just would like to creat an event in a calendar that a creat with a
createCalendar() function.
The calendar is perfectly created, but I don't know how to add an
event in this new calendar.
I'm able to creat an event in the main calendar of my account with
this code :
private static CalendarEventEntry createEvent(CalendarService service,
String eventTitle, String eventContent, String recurData,
boolean isQuickAdd, WebContent wc) throws
ServiceException,
IOException {
CalendarEventEntry myEntry = new CalendarEventEntry();
myEntry.setTitle(new PlainTextConstruct(eventTitle));
myEntry.setContent(new PlainTextConstruct(eventContent));
myEntry.setQuickAdd(isQuickAdd);
myEntry.setWebContent(wc);
if (recurData == null) {
Calendar calendar = new GregorianCalendar();
DateTime startTime = new DateTime(calendar.getTime(),
TimeZone
.getDefault());
calendar.add(Calendar.MINUTE, 30);
DateTime endTime = new DateTime(calendar.getTime(),
TimeZone.getDefault());
When eventTimes = new When();
eventTimes.setStartTime(startTime);
eventTimes.setEndTime(endTime);
myEntry.addTime(eventTimes);
} else {
Recurrence recur = new Recurrence();
recur.setValue(recurData);
myEntry.setRecurrence(recur);
}
return service.insert(eventFeedUrl, myEntry);
/*the eventFeedUrl is "http://www.google.com/calendar/feeds/
[EMAIL PROTECTED]/private/full" in my code */
}
private static CalendarEventEntry createSingleEvent(CalendarService
service,
String eventTitle, String eventContent) throws
ServiceException,
IOException {
return createEvent(service, eventTitle, eventContent, null,
false, null);
}
And in the main function :
CalendarEventEntry singleEvent = createSingleEvent(myService,
"I need help", "Help me please.");
System.out.println("Successfully created event "
+ singleEvent.getTitle().getPlainText());
So I don't know if the probleme is about the eventFeedUrl, because
it's refering to the main calendar [EMAIL PROTECTED] But how to
refered it with the new calendar?
I didn't find any solution in the the Help of the Calendar API exept
create an event always in the main calendar.
Thank you!! :)
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---