Event Created: Undefined

356 views
Skip to first unread message

chad...@gmail.com

unread,
Jan 21, 2016, 5:48:31 PM1/21/16
to Google Calendar API
Hello,
I am testing the event creation JavaScript method for Google Calendar using the example provided by Google at the page linked below. I had success with the return events example but not the create event example. I am getting the following message on screen "Event Created: undefined" and when I check my calendar the event does not exist.

Here is my exact code

var event = {
  'summary': 'LF Test',
  'location': 'Phone',
  'description': 'Test Event',
  'start': {
    'dateTime': '2016-01-22T09:00:00-07:00',
    'timeZone': 'America/Los_Angeles'
  },
  'end': {
    'dateTime': '2016-01-22T17:00:00-07:00',
    'timeZone': 'America/Los_Angeles'
  },
  'recurrence': [
    'RRULE:FREQ=DAILY;COUNT=2'
  ],
  'attendees': [
    {'email': 'te...@test.com'},
  ],
  'reminders': {
    'useDefault': false,
    'overrides': [
      {'method': 'email', 'minutes': 24 * 60},
      {'method': 'popup', 'minutes': 10}
    ]
  }

var request = gapi.client.calendar.events.insert({
  'calendarId': 'primary',
  'resource': event
});

request.execute(function(event) {
  appendPre('Event created: ' + event.htmlLink);
});


Here is the example from Google: https://developers.google.com/google-apps/calendar/create-events


chad...@gmail.com

unread,
Jan 26, 2016, 2:55:19 PM1/26/16
to Google Calendar API
Figured this one out. My SCOPE was set to the read only scope. Needed to remove .readonly.
Reply all
Reply to author
Forward
0 new messages