All pastes #2092854 Raw Edit

Posting to Google Calendar via g

public javascript v1 · immutable
#2092854 ·published 2011-11-07 21:47 UTC
rendered paste body
// 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 eventvar entry = new google.gdata.calendar.CalendarEventEntry();// Set the title of the evententry.setTitle(google.gdata.atom.Text.create('My New Event'));// Create a When object that will be attached to the eventvar when = new google.gdata.When();// Set the start and end time of the When objectvar 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 invitevar 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 notifyentry.addParticipant( who );// turn notifications onentry.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 calendarmyService.insertEntry(feedUrl, entry, callback,     		    handleError, google.gdata.calendar.CalendarEventEntry);      // Close the authorization with google to exit cleanlygoogle.accounts.user.logout();