Is there a way to create a calendar event using javascript?
I have a folder rule to execute a javascript that I would like to create an event in the site's calendar.
I am using code that is similar to what I used to create datalist items and it seems to create the item but the item does not look right when I compare it to an item that I create through the UI
I use the childByNamePath() to get the site Calendar "siteCalendar". The item gets created but the primary path ends with something like this "cm:_x0037_3b5d28b-48ad-45e3-8f5c-a2c6eb0405df" rather than an ics name like "1594842338500-5440ics"
var myEvent = siteCalendar.createNode(null, "ia:calendarEvent")
myEvent.properties["ia:whereEvent"] = "Where event";
myEvent.properties["ia:descriptionEvent"] = "This is the description";
var fromDate = new Date();
var fromISODate = utils.toISO8601(fromDate);
myEvent.properties["ia:fromDate"] = fromISODate;
var toDate = new Date();
toDate.setHours(toDate.getHours() + 1);
var toISODate = utils.toISO8601(toDate);
myEvent.properties["ia:toDate"] = toISODate;
myEvent.properties["ia:whatEvent"] = "What event";
myEvent.save();
logger.warn("Created new calendar event: " + myEvent.nodeRef);