ebeigarts / exchanger

Ruby client for Exchange Web Services

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Recurring Event

itsbriantruong opened this issue · comments

I am having trouble creating a recurring event. What parameters must be set? I keep getting invalid elements when I try to set parameters such as

calendar_item_type => 'RecurringMaster'

Can someone provide an example

I haven't used recurring events :(

ahh okay. Do you, by chance, know how to make it so attendees "accept" their invite automatically?

Don't know, is that even possible?

The Google Calendar api supports it, so I was hoping exchange would as well :/

I was also struggling to get recurring event's - solution was to patch find_item.rb and add this CalendarView to SOAP call specifying start & end date.
More about CalendarView

Not sure if I did the best implementation, but when I will refactor my code I could try to create Pull Request - let's hope somebody will be able to take a look on it :)

@janis-vitols pull requests are welcome :)

I figured out how to create recurring events, in my case I wanted an event to repeat every second week forever, here's what I did:

class WeeklyRecurrence < Exchanger::Element
  element :interval, :type => Integer
  element :days_of_week, :type => String
end

class NoEndRecurrence < Exchanger::Element
  element :start_date, type: String
end

class Recurrence < Exchanger::Element
  element :weekly_recurrence, :type => WeeklyRecurrence
  element :no_end_recurrence, type: NoEndRecurrence
end

calendar = Exchanger::Folder.find(:calendar, 'user@example.com')
item = calendar.new_calendar_item({
  start: '2017-09-14T11:42:18+02:00',
  end: '2017-09-14T12:42:18+02:00',
  subject: 'My Recurring Test Event',
  recurrence: Recurrence.new(
    no_end_recurrence: NoEndRecurrence.new(start_date: '2017-09-14+02:00'),
    weekly_recurrence: WeeklyRecurrence.new(interval: 2, days_of_week: 'Thursday')
  )
})
item.save

Remarks: Microsoft uses a date string with the time zone appended to the and as start date for the NoEndRecurrence so I just made it a String type instead of a Date type.

There are more recurring types such as "NumberedOccurences" etc.

@ebeigarts: If this is of any use for you I could start a PR with a proper implementation of those element types.

@sled I'm not using exchanger anymore, but pull requests are welcome, maybe someone else needs this too.