tritech / node-icalendar

iCalendar parser and generator for Node.js
MIT License
234 stars 50 forks source link

Outlook and Live needs UID #21

Closed gh-naylor closed 10 years ago

gh-naylor commented 10 years ago

When creating a collection of events it's not possible to set a unique id on the VEVENT using addComponent (or is it?). This causes problems when trying to subscribe to the calendar in outlook and on live.com.

For example, live.com gives the error "This calendar wasn't updated because of a problem with the publisher's file (the file's events don't have UID properties). We'll try updating it again later."

mattkalina commented 10 years ago

I believe you need to either create the VEvent prior to adding it to the calendar with addComponent or call addProperty('UID', ...) on the return value from addComponent('VEVENT').

var ical = new icalendar.iCalendar();
var event = new icalendar.VEvent('cded25be-3d7a-45e2-b8fe-8d10c1f8e5a9');
ical.addComponent(event);
var ical = new icalendar.iCalendar();
var event = ical.addComponent('VEVENT');
event.addProperty('UID', 'cded25be-3d7a-45e2-b8fe-8d10c1f8e5a9');

Does that answer your question?

gh-naylor commented 10 years ago

thanks @mattkalina, event.addProperty('UID', 'cded25be-3d7a-45e2-b8fe-8d10c1f8e5a9'); was exactly what I needed!