UID issue: only last event submitted

2.8k views Asked by At

Ok guys, here's the nasty business: I made a batch file that make an .ics file that I should "upload" in my Google calendar daily. Now, the batch works just fine, the problem is the behaviour that I'm having with the result.

Long story short, if I put the UID into the VEVENT happens that only the last event is submitted to the calendar.

Example:

BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//prodvam v0.3//EN
METHOD:PUBLISH
BEGIN:VEVENT
UID:prod
STATUS:CONFIRMED
SEQUENCE:0
DTSTART;VALUE=DATE:20141112
SUMMARY:SUMMARY1
END:VEVENT
BEGIN:VEVENT
UID:prod
STATUS:CONFIRMED
SEQUENCE:0
DTSTART;VALUE=DATE:20141112
SUMMARY:SUMMARY2
END:VEVENT
END:VCALENDAR

This, will only submit an event called SUMMARY2 dated 12 of november...

I know that the UID isn't necessary in order to submit an event, but it is a must if I want to delete the event later [and I need it, so i can't just erase that line of "code"].

I can erase events, create the .ics files and everything, only, I just can't understand why the UID would make only the last event to be submitted!

I tried adding/subbing various things, even the nosense-ones, like the comments of the events...

I am doing something wrong? Any Tip?

2

There are 2 answers

0
Auberon Vacher On BEST ANSWER

luc gives a valid answer to your problem, however you are at risk of not having a globally unique ID.

UID means Unique Identifier "Unique ID" which is a persistent, globally unique identifier for the calendar component. To ensure global uniqueness, RFC (See https://www.rfc-editor.org/rfc/rfc5545#section-3.8.4.7 ) gives guidelines on how to ensure they are globally unique :

A good method to assure uniqueness is to put the domain name or a domain literal IP address of the host on which the identifier was created on the right-hand side of an "@", and on the left-hand side, put a combination of the current calendar date and time of day (i.e., formatted in as a DATE-TIME value) along with some other currently unique (perhaps sequential) identifier available on the system (for example, a process id number)

BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//ingrossod//Compagnia VAM v0.3//EN
METHOD:PUBLISH
BEGIN:VEVENT
UID:20141112_SUMMARY1@ingrossod
STATUS:CONFIRMED
SEQUENCE:0
DTSTART;VALUE=DATE:20141112
SUMMARY:SUMMARY1
END:VEVENT
BEGIN:VEVENT
UID:20141112_SUMMARY2@ingrossod
STATUS:CONFIRMED
SEQUENCE:0
DTSTART;VALUE=DATE:20141112
SUMMARY:SUMMARY2
END:VEVENT
END:VCALENDAR
0
luc On

Each event should have its own UID. Your file fixed:

BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//ingrossod//Compagnia VAM v0.3//EN
METHOD:PUBLISH
BEGIN:VEVENT
UID:ingrossod1
STATUS:CONFIRMED
SEQUENCE:0
DTSTART;VALUE=DATE:20141112
SUMMARY:SUMMARY1
END:VEVENT
BEGIN:VEVENT
UID:ingrossod2
STATUS:CONFIRMED
SEQUENCE:0
DTSTART;VALUE=DATE:20141112
SUMMARY:SUMMARY2
END:VEVENT
END:VCALENDAR