I'm unable to create Recurring events using the google calendar API's. I'm able to create singular events, but if I add a "recurrence" rule into the recurrence property, I get an error message saying "The operation couldn’t be completed. (Invalid Value)" (timezone.name = America/New_York)
I'm using the below code to create the event object, If the condition is false, the event gets created on the google calendar My question is, how does one create an Recurring event using Google Calendar API? Can anyone tell me what i'm doing wrong below?
Thanks in advance for the help.
let gEvent = GTLCalendarEvent()
let timeZone = NSTimeZone.systemTimeZone()
let startTime = NSDate.dateFromString("2016-10-18 21:31:00 +0000")
let endTime = NSDate.dateFromString("2016-10-18 22:31:00 +0000")
let start = GTLCalendarEventDateTime()
let end = GTLCalendarEventDateTime()
if event.EventRepeat.toBool() == true {
end.dateTime = GTLDateTime(date:endTime, timeZone: nil)
start.dateTime = GTLDateTime(date:startTime, timeZone: nil)
start.timeZone = timeZone.name
end.timeZone = timeZone.name
gEvent.recurrence = ["FREQ=WEEKLY;BYDAY=SU,MO,TU,WE,TH,FR,SA;INTERVAL=1;UNTIL=20171031T040000Z"]
}else{
end.dateTime = GTLDateTime(date:endTime, timeZone: timeZone)
start.dateTime = GTLDateTime(date:startTime, timeZone: timeZone)
}
gEvent.start = start
gEvent.end = end
gEvent.summary = "Example Event"
gEvent.descriptionProperty = "Example Event Description"
return gEvent