1

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?

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

1 Answer 1

1

Had the wrong RRule setup. Solved it! Here's a template

RRULE:FREQ=WEEKLY;UNTIL=20190628;BYDAY=SU,MO

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.