Hi,
I am not sure I understand your post correctly, but it seems like you are
having trouble creating a new calendar with the Java client library, this is
a code snippet of how to do that -
public void createCalendar() throws Exception {
CalendarService calendarService = new
CalendarService("calendar_service");
calendarService.setUserCredentials("username", "pw");
CalendarEntry calendar = new CalendarEntry();
calendar.setTitle(new PlainTextConstruct("create calendar"));
calendar.setSummary(new PlainTextConstruct("This calendar is created by
Java Client"));
calendar.setTimeZone(new TimeZoneProperty("America/Los_Angeles"));
calendar.addLocation(new Where("","","Mountain View"));
URL feedUrl = new URL("
http://www.google.com/calendar/feeds/default/owncalendars/full");
CalendarEntry resultEntry = calendarService.insert(feedUrl, calendar);
System.out.println("Calendar is created");
}
Hope that helps,
Austin
On Thu, Jul 17, 2008 at 1:50 AM, Fritz <[EMAIL PROTECTED]> wrote:
>
> hi !
>
> im programming in java and want to create an album and after that an
> calendar!
> well the album will be created all the time but to create the calendar
> works not all the time.
>
> public void createCalendar(Location location) {
>
> log.info("CalendarService create calendar");
> this.authenticate();
>
> // Create the calendar
> CalendarEntry calendar = new CalendarEntry();
> calendar.setTitle(new
> PlainTextConstruct(location.getName()));
> calendar.setSummary(new
> PlainTextConstruct(location.getDescription()));
> calendar.setTimeZone(new TimeZoneProperty("Europe/Vienna"));
> calendar.setHidden(HiddenProperty.FALSE);
> calendar.setColor(new ColorProperty("#2952A3"));
> calendar.addLocation(new Where("","","Graz"));
>
> // Insert the calendar
> try {
> URL postUrl = new URL("
> http://www.google.com/calendar/feeds/default/
> owncalendars/full<http://www.google.com/calendar/feeds/default/owncalendars/full>
> ");
> CalendarEntry returnedCalendar =
> myService.insert(postUrl,
> calendar);
> facesMessages.add("Calendar sucessfuly created for
> location");
> } catch (Exception e) {
> e.printStackTrace();
> }
> }
>
> com.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>
> 10:11:36,519 ERROR [STDERR] at
> com.google.gdata.client.http.HttpGDataRequest.handleErrorResponse(Unknown
> Source)
> 10:11:36,519 ERROR [STDERR] at
> com.google.gdata.client.http.GoogleGDataRequest.handleErrorResponse(Unknown
> Source)
> 10:11:36,519 ERROR [STDERR] at
> com.google.gdata.client.http.HttpGDataRequest.checkResponse(Unknown
> Source)
> 10:11:36,519 ERROR [STDERR] at
> com.google.gdata.client.http.HttpGDataRequest.execute(Unknown Source)
> 10:11:36,519 ERROR [STDERR] at
> com.google.gdata.client.http.GoogleGDataRequest.execute(Unknown
> Source)
> 10:11:36,519 ERROR [STDERR] at
> com.google.gdata.client.Service.insert(Unknown Source)
> 10:11:36,519 ERROR [STDERR] at
> com.google.gdata.client.GoogleService.insert(Unknown Source)
> 10:11:36,519 ERROR [STDERR] at
> com.stereoscope.session.google.Calendar.createCalendar(Calendar.java:
> 106)
>
>
>
> i do the authentication for the picasa service and the second time
> when it gets to the calendar service!
>
> the next question i have is: ho do i add an event to a specific
> calender if i just know the name of it!?
>
> public void createEvent(Event event) throws IOException,
> ServiceException {
>
> Utility util = new Utility();
>
> try {
> CalendarEventEntry myEntry = new
> CalendarEventEntry();
>
> myEntry.setTitle(new
> PlainTextConstruct(event.getName()));
> myEntry.setContent(new
> PlainTextConstruct(event.getDescription()));
>
> log.info("EventStartDate: " +
> event.getStartDate());
> DateTime startTime =
> DateTime.parseDateTime(util.convertDate(event.getStartDate()));
> DateTime endTime =
> DateTime.parseDateTime(util.convertDate(event.getEndDate()));
> When eventTimes = new When();
> eventTimes.setStartTime(startTime);
> eventTimes.setEndTime(endTime);
> myEntry.addTime(eventTimes);
>
> URL postUrl = new URL("
> http://www.google.com/calendar/feeds/" +
> user.getGoogleUserId() + "/private/full");
> // Send the request and receive the response:
> CalendarEventEntry insertedEntry =
> myService.insert(postUrl,
> myEntry);
> } catch (Exception e) {
> e.printStackTrace();
> }
> }
>
>
> this code is from the docs but how has the url to look to get those
> thing started!?
>
>
> cheers
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---