icalendar / icalendar

icalendar.rb main repository

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Would it be possible to override the UID property?

SLuoWorkRamp opened this issue · comments

Hi!

Thanks for the wonderful gem and all the great functionality!

We're running into some issues updating existing events created via ICS files generated by icalendar.

We're using icalendar to generate ICS files for specific events to attach to emails and send to our users. When the details for an event changes, like the start or end times, we would like to send another ICS file which would update the existing event, as opposed to creating a new one.

It looks like to do this we need to be able to persist and send back the original ICS file's UID value, increment the SEQUENCE, and be sure to have an ORGANIZER in the respective ICS files.

We can definitely persist generated ICS files in our application and associate them with a particular event and user that received the ICS file in the first place. This will then give us the original ICS file's UID value, and given how many of these have been sent before we can calculate the SEQUENCE number.

However, it doesn't look like icalendar provides the ability to override the generated UID field.

Any insight and help would be appreciated! Thanks in advance!

If you parse the original ICS then the resulting event will have the correct UID already set.

Otherwise, you are correct that event = Icalendar::Event.new will result in a different UID, but you can then call event.uid = saved_uid_value to set it back to what you need.

Hope that helps.

THANKS SO MUCH FOR THE INSIGHT!

That was exactly what we needed!