0

When working with my calendar, I do the following to create an allDayEvent which spans more than one day (e.g.Vacation or scool halidays): - I create an allDayEvent for the 1st day - I click on the event - now I may enter the last date and save the event.

How may I do this in a script? I may get the flag with "isAllDayEvent"; I may set a date with "setAllDayDate"; but how to set a start-date and an end-date to an AllDayEvent?

Wolfram
  • 5
  • 1
  • 4

1 Answers1

1

You have to use recurrence, see full documentation here

In your example it would use addDailyRule to repeat every day and until to define endDate.

Serge insas
  • 45,904
  • 7
  • 105
  • 131
  • I'm trying to update a Google Calendar event to a recurring multiple all-day event so using a repeat rule to extend the event duration doesn't help. setAllDayDate() works fine but setAllDayDates() gives a timed event starting at midnight + my GMT offset, spanning an extra day. I can reset recurrence thanks to Serge (https://stackoverflow.com/a/35485356/283182), but I get 404 errors patching even when using the previously returned Events resource for sequence https://stackoverflow.com/questions/24364004/google-calendar-api-event-update-with-the-ruby-gem and I can't find any official docs! – jazzwhistle Apr 30 '19 at 14:20
  • After more tests it turns out setAllDayDates(startDate, endDate) is correctly creating an all day event lasting several days, but then adding the recurrence with setRecurrence(recurrence, startDate, endDate); converts the event to a single timed repeat at 2am (when using GMT+2) lasting an extra day. If the UI didn't support all-day repeats which last longer than a day, I'd understand... but it does. – jazzwhistle Apr 30 '19 at 22:33
  • You will have to use the advanced calendar service for that. It basically offers all the options available in the ui. Read this post to see how to access : https://stackoverflow.com/questions/35477612/google-calendar-script-remove-recurrence/35485356#35485356 – Serge insas May 01 '19 at 09:00
  • Thank you, it does indeed work as long as I use advanced calendar service to set start, end AND recurrence. – jazzwhistle May 02 '19 at 12:08