Hi, I am able to successfully add an entry into a calendar event. The challenge I have now is how to substitute a variable in the who.setEmail() parameter instead of having a hardcoded email address in it. For example, my code works if I have who.setEmail ("eol...@bigpond.net.au"), but won't work if I use a variable inside it: var emailAddrField = GetFieldValue("EMAIL_ADDRESS"); var = emailAddr = '"'+"eol...@serena.com"+'"'; \\enclose the email addr with double quotes alert(emailAddr); who.setEmail(emailAddr);
I get an object error, when I try to use variables on the who.setEmail call. Has anyone got an idea how to substitute a variable? Below is my code to create the event... Thanks, Erwin function insertIntoMyFeed() \{ // Create the calendar service object var calendarService = new google.gdata.calendar.CalendarService('Erwin Oliva'); // The default "private/full" feed is used to insert event to the // primary calendar of the authenticated user var feedUri = 'http://www.google.com/calendar/feeds/default/private/ full'; // Create an instance of CalendarEventEntry representing the new event var entry = new google.gdata.calendar.CalendarEventEntry(); // Set the title of the event // Set the title and content of the event var titleField = GetFieldValue("TITLE"); entry.setTitle(google.gdata.Text.create(titleField)); entry.setContent(google.gdata.Text.create('SBM Post to Google Calendar')); // 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 stime = "2009-07-29T15:00:00.000+10:00"; var etime = "2009-07-29T16:00:00.000+10:00"; var startTime = google.gdata.DateTime.fromIso8601(stime); var endTime = google.gdata.DateTime.fromIso8601(etime); when.setStartTime(startTime); when.setEndTime(endTime); // Add the When object to the event entry.addTime(when); // Create a Who object that will be attached to the event var who = new google.gdata.Who(); var emailAddrField = GetFieldValue("EMAIL_ADDRESS"); //emailAddr = '"'+emailAddrField+'"'; var = emailAddr = '"'+"eol...@serena.com"+'"'; alert(emailAddr); who.setEmail(emailAddr); who.setRel("g.event.attendee"); // Add the Who object to the event entry.addParticipant(who); // Create a When object that will be attached to the event var where = new google.gdata.Where(); var venueField = GetFieldValue("VENUE"); where.setValueString(venueField); where.setRel("g.event"); // Add the Who object to the event entry.addLocation(where); --~--~---------~--~----~------------~-------~--~----~ 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 google-calendar-help-dataapi@googlegroups.com To unsubscribe from this group, send email to google-calendar-help-dataapi+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/google-calendar-help-dataapi?hl=en -~----------~----~----~----~------~----~------~--~---