Creating a .ics file for classes schedule - google-calendar-api

I currently have an .ics file, which is to be used as a schedule for my classes. It should contain all the classes, their duration and starting time, and repeat weekly (but, if Class X is at 9:00 both Monday and Tuesday, and at 10:00 on a Thursday, this makes 2 seperate events with different UIDs but same Summary) until Y date. Upon testing this, and adding it to Google Calendar, an error shows up: "Added Z of [TOTAL] events". I have managed to reproduce the error (in this case, "Added 1 of 2 events") with the following events:
BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//2 2017/2018//PT
BEGIN:VEVENT
UID:0
DTSTAMP:20180713T132719
DTSTART:20180219T100000
SUMMARY:Class 1
LOCATION:Location 1
DURATION:PT1H30M
RRULE:FREQ=WEEKLY;INTERVAL=1;UNTIL=20180601T000000;WKST=SU;BYDAY=MO
END:VEVENT
BEGIN:VEVENT
UID:11
DTSTAMP:20180713T132719
DTSTART:20180221T080000
SUMMARY:Class 2
LOCATION:Location 2
DURATION:PT1H30M
RRULE:FREQ=WEEKLY;INTERVAL=1;UNTIL=20180601T000000;WKST=SU;BYDAY=WE
END:VEVENT
END:VCALENDAR
Only the second event gets correctly added to Google Calendar. Why? If I strip away the event for Class 2, the icalendar validator shows no errors. There also aren't any errors (in the validator) with the 2 events.
Any pointers to the right direction are greatly appreciated.

Change your UID's to something that is guaranteed to be unique (or at least not zero). See https://www.kanzaki.com/docs/ical/uid.html
I changed the UID's in your file after checking that yes the one with UID=0 did not load. Both events then loaded.
For my ics files I use the website url plus a unique identifier (eg for wordpress sites, it's the post id added to the wp url)

Related

Google doesn't sync my subscribed ICS feed

I have a ICS feed for a calendar, that I subscribe from Google calendar.
As soon as I add the feed, it shows all the events perfectly. But when I edit events, it doesn't update. So it seems like it can read the feed, but doesn't sync it.
If I remove the feed and add it again, its still not synced. But if I add a parameter to the url (ex. &x=1), it will import the updates, but still not sync. So it seems like Google is caching the feed pr. url, but doesn't sync after the url has been added.
Anyone else had this issue, or know a solution?
SOLUTION UPDATE: 12/03 - 2020
I missed the fields "SEQUENCE" and "LAST-MODIFIED". Credits to #anmari for spotting the error.
The calendar now syncs perfectly with Google.
Example from the ICS file:
BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//ZContent.net//Zap Calendar 1.0//EN
CALSCALE:GREGORIAN
METHOD:PUBLISH
BEGIN:VEVENT
SUMMARY:Gudstjeneste - prædiken ved Enok Sørensen
UID:1177
DTSTART:20190915T073000Z
DTEND:20190915T103000Z
DTSTAMP:20190907T164050Z
LAST-MODIFIED:20200311T195313Z
SEQUENCE:2
LOCATION:Nørregade 13, 6900 Skjern
URL:https://www.lm-kirken.dk/kalender/gudstjeneste-15-09/
END:VEVENT
BEGIN:VEVENT
SUMMARY:Fredagsfællesskab
UID:1248
DTSTART:20190920T153000Z
DTEND:20190920T180000Z
DTSTAMP:20190909T201436Z
LAST-MODIFIED:20200312T062507Z
SEQUENCE:1
LOCATION:Nørregade 13, 6900 Skjern
URL:https://www.lm-kirken.dk/kalender/fredagsfaellesskab-20-09/
END:VEVENT
BEGIN:VEVENT
SUMMARY:Gudstjeneste - prædiken ved Leif Bach Kofoed
UID:1214
DTSTART:20190929T083000Z
DTEND:20190929T103000Z
DTSTAMP:20190909T185328Z
LAST-MODIFIED:20200311T210357Z
SEQUENCE:1
LOCATION:Nørregade 13, 6900 Skjern
URL:https://www.lm-kirken.dk/kalender/gudstjeneste-29-9/
END:VEVENT
END:VCALENDAR
Bjorn
to tell any calendar application that an event has been updated (so that it will sync it) one needs fields to be updated for the event that is being modified, and add:
LAST-MODIFIED:19960817T133000Z
SEQUENCE:1 (of update)
See also
ics event update failed in web calendar
and
Icalendar ICS update not working in google calendar
and the specification
https://www.rfc-editor.org/rfc/rfc5545#section-3.8.7.4

Google calendar backup does not save event creation date

Is there a way to backup a Google calendar and then import it while saving the creation dates of events? This is critical for me to calculate when appointments were created (weekly billing cycle), as opposed to when they are scheduled for (perhaps months down the road).
I've tested it, and when you import and exported calendar, it marks all events as created on the date they were imported on, not when they were actually created, which is ludicrous.
Does anyone know a work around to save the getCreated date?
Thanks a bunch, Bob
You can open the .ICS file of the exported calendar and check the event creation date and time. Every event starts with a BEGIN and ends with an END tag as below:
BEGIN:VEVENT
DTSTART:20160404T143000Z
DTEND:20160404T150000Z
DTSTAMP:20160405T230139Z
UID:i0juj2f62qeth85ip6qucbul8g#google.com
CREATED:20160404T103834Z
DESCRIPTION:
LAST-MODIFIED:20160404T103843Z
LOCATION:
SEQUENCE:0
STATUS:CONFIRMED
SUMMARY: Meet Richard in the office
TRANSP:OPAQUE
END:VEVENT
Hope that helps.. Use Notepad++, works well
Also check this https://webapps.stackexchange.com/questions/9043/how-can-i-find-out-when-i-added-an-event-to-my-google-calendar

Auto accepting the .ics files in outlook

I am trying to generate iCalender files in asp.net. An ics file with below details is downloaded for the user and when user clicks it it opens the outlook calender entry which the user have to Save and close again.
Can we make it a one stop process where user just have to click the file and it goes to outlook calendar directly?
Please note the 'Automatically accept meetings' setting in outlook is turned on. What am i missing then.
Thanks for the help.
BEGIN:VCALENDAR
PRODID:-//Schedule a Meeting
VERSION:2.0
METHOD:PUBLISH
BEGIN:VEVENT
DTSTAMP:20160115T144939Z
DTSTART:20160111T040000Z
DTEND:20160111T050000Z
SEQUENCE:0
UID:12579759-1604-47e8-ac51-d1ae3d17425d
CREATED:20160115T144939Z
LAST-MODIFIED:20160115T144939Z
LOCATION: Meeting Room2
DESCRIPTION:Meeting Number 2
SUMMARY:Meeting Number 2
END:VEVENT
END:VCALENDAR
What I think is you can't accept meeting of some one else through ICS. But you can give a try for STATUS: CONFIRMED

Google ics calendar feed fullday events

I have a full day event which I want to export to my Google calendar via an ics file. The format of the ics file is as follows
BEGIN:VCALENDAR
VERSION:2.0
TYPE:VCALENDAR
UID:xxx
PRODID:-//ABC//EN
X-PUBLISHED-TTL:1
CALSCALE:GREGORIAN
X-WR-CALNAME:ABC TEST - Calendar
BEGIN:VEVENT
TYPE:VEVENT
UID:xxx
STATUS:CONFIRMED
SEQUENCE:0
SUMMARY:Full day event
DESCRIPTION:
TRANSP:TRANSPARENT
DTSTART:20130910T000000Z
DTSTAMP:20130909T235959Z
DTEND:20130910T000000Z
I am facing 2 problems
In Google this event does not show up as a full day event i.e. It shows up as a normal event
How do I remove the time from the event i.e. Its a full day event but showing up as starting at 5:30 am . I am in the Indian Timezone UTC +5:30
You need to use the DATE format of RFC5545
In your case, that would be
DTSTART;VALUE=DATE:20130910
On the other hand, you do not need a DTEND.
You should also remove those TYPE properties ("TYPE:VCALENDAR" and "TYPE:VEVENT") which are not valid.
Finally, the first UID property (the one directly under TYPE:VCALENDAR) is not valid there. Only the second one is valid and required.

Recurrent events in iCalendar not working

I'm trying to add recurring events to my personal calendar via .ics, The client imports and adds the first event to the calendar but doesn't create other repeating events.
I'm actually creating a recurring event which happens daily, below is the sample of my .ics file.
BEGIN:VCALENDAR
PRODID;X-RICAL-TZSOURCE=TZINFO:-//com.denhaven2/NONSGML ri_cal gem//EN
CALSCALE:GREGORIAN
VERSION:2.0
METHOD:REQUEST
BEGIN:VEVENT
CREATED;VALUE=DATE-TIME:20111103T182116Z
DTEND;VALUE=DATE-TIME:20111104T130000Z
STATUS:CONFIRMED
DTSTART;VALUE=DATE-TIME:20111104T103000Z
TRANSP:OPAQUE
DTSTAMP;VALUE=DATE-TIME:20111103T182116Z
LAST-MODIFIED;VALUE=DATE-TIME:20111103T182116Z
UID:availability_slot42#chronus.com
DESCRIPTION:Availability slot from mentoring program
SUMMARY:Mentoring Slot
ORGANIZER:iitm_mentor3#chronus.com
RRULE:FREQ=DAILY;WKST=MO;
EXRULE:FREQ=WEEKLY;BYDAY=SA,SU
LOCATION:Daily withoiut until
SEQUENCE:0
END:VEVENT
END:VCALENDAR
looks like the problem is with the client s/w, not your ics file.
Your code above validates at http://severinghaus.org/projects/icv/
and loads and recurs fine in google calendar.
see https://www.google.com/calendar/embed?src=jpkdu09olie8uveopl72oguj2s%40group.calendar.google.com&ctz=Australia/Sydney
Cross test on some more other calendar clients to verify.

Resources