// This code is for creating an event on Google calendar using the gData API // The service has already been created and the user has been logged in... myService.getEventsFeed( feedUrl, handleMyFeed, handleError ); // Create an instance of CalendarEventEntry representing the new event var entry = new google.gdata.calendar.CalendarEventEntry(); // Set the title of the event entry.setTitle(google.gdata.atom.Text.create('My New Event')); // Create a When object that will be attached to the event var when = new google.gdata.When(); // Set the start and end time of the When object var startTime = google.gdata.DateTime.fromIso8601("2011-06-09T09:00:00.000-08:00"); var endTime = google.gdata.DateTime.fromIso8601("2011-06-09T10:00:00.000-08:00"); when.setStartTime(startTime); when.setEndTime(endTime); // Define a guest to invite var who = new google.gdata.calendar.EventWho(); who.setEmail( 'person.to.invite@gmail.com' ); entry.setContent( google.gdata.atom.Text.create( "Customer Full Name, Phone Number, Email" )); entry.addLocation( new google.gdata.Where({ rel: google.gdata.Where.REL_EVENT, label: "Event Location", valueString: "Customer's Address Goes Here" })); // Add our user to notify entry.addParticipant( who ); // turn notifications on entry.setSendEventNotifications( true ); /* currently notifications don't seem to be working */ // Add the When object to the event entry.addTime( when ); // Insert the new calendar event into the specified calendar myService.insertEntry(feedUrl, entry, callback, handleError, google.gdata.calendar.CalendarEventEntry); // Close the authorization with google to exit cleanly google.accounts.user.logout();