Calendar.Events.patch returns error mentioning "Invalid start time"

338 views
Skip to first unread message

Matheus Reich

unread,
Dec 29, 2022, 9:22:14 AM12/29/22
to Google Apps Script Community
Hello fellow coders!

I have been using a script that I've written, and it has since started to fail when the Calendar.Events.patch function runs.
The code is written as follows:

 var action ={'start': {
      'dateTime'startTime.toISOString()
    },
    'end': {
      'dateTime'ReturnDateFormatted.toISOString()
    },
    'sendNotifications''true'// email the invite
  };
  Calendar.Events.patch(actiondefaultCalendarIdarrayEventId[0],{sendUpdates"all"});

Where both CalendarId and EventId are all set up correctly, but the issue lies on the time. The console output for both start and end time is:

startTime: 2022-12-30T03:00:00.000Z
endTime: 2023-02-02T00:00:00.000Z

Which is correctly formatted, but the API returns a error, as previously mentioned. Does anyone if there's an ongoing issue with Google Calendar's API, or is my code gone somehow kapputt out of nowhere?
Message has been deleted

Andrew Roberts

unread,
Dec 30, 2022, 7:17:18 AM12/30/22
to google-apps-sc...@googlegroups.com
Are you importing events from other calendar types? I remember a similar issue when I had a client importing iCal events into a Google Calendar.

On Thu, 29 Dec 2022 at 14:54, Matheus Reich <matheu...@gmail.com> wrote:
And now, interestingly, it is failing on a different line, where it calls:

var event = CalendarApp.getEventById(eventId);

and it generates an error " Exception: Invalid argument: iCalId", which makes me believe that there's an ongoing issue with Google's API indeed, because this line was definitely working correctly, and I didn't change literally anything on my code since the previous test (my original post). I'll keep an eye for what's going on, and also wait for anyone that might help me in this regard.

--
You received this message because you are subscribed to the Google Groups "Google Apps Script Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-script-c...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-script-community/da970240-ee4a-4130-8c04-efe3c8e68afcn%40googlegroups.com.

Matheus Reich

unread,
Dec 30, 2022, 7:40:12 AM12/30/22
to Google Apps Script Community
Interestingly, no. I am simply accessing the default calendar for that Google account, and adding/modifying events based on a Google Forms trigger. What I found interesting is that even when using the example provided by Google on their guide for the Advanced Calendar API, it fails too with the same issue.
Reply all
Reply to author
Forward
0 new messages