1

I would really like to use CiviCRM's function to create an ical feed for the calendar. But I'm having some hard times to get it working.

The event has a title, a date, a custom category and a 'long description'. When you visit the url to the ical feed: https://example.tld/civicrm?page=CiviCRM&q=civicrm%2Fevent%2Fical&reset=1

you get the following .ics file

civicrm_ical.ics

BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//CiviCRM//NONSGML CiviEvent iCal//EN
X-WR-TIMEZONE:Europe/Amsterdam
METHOD:PUBLISH
BEGIN:VEVENT
UID:CiviCRM_EventID_4_215ca88ba6fc880ae683205e6cd7bc8d@example.tld
SUMMARY:Test-event
DESCRIPTION:Some description
CATEGORIES:ALV
CALSCALE:GREGORIAN
DTSTAMP;VALUE=DATE-TIME:20190401T200000
DTSTART;VALUE=DATE-TIME:20190401T200000
DTEND;VALUE=DATE-TIME:20190402T030000
URL:https://example.tld/civicrm/?page=CiviCRM&q=civicrm%2Fevent%2Finfo&reset=1&id=4
END:VEVENT
END:VCALENDAR

But when I use the url of the feed in fastmail or google calendar for instance, an error appears, or the calendar items do not appear. What could be the problem?

I use CiviCRM 5.10.3 on Wordpress.

Kind regards,

Sam

--- edit ---

I got the following error message from Fastmail, my mailprovider.

Syncing to your [redacted] calendar has been disabled: [ad2278bd-7237-4dee-884f-4eff6f3666bc] The calendar data was invalid: Error parsing VCalendar data: error Closed a different card name than opened at line 7 char 0:

---> BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//CiviCRM//NONSGML CiviEvent iCal//EN
X-WR-TIMEZONE:Europe/Amsterdam
METHOD:PUBLISH
END:VCALENDAR
 <--- at /usr/lib/x86_64-linux-gnu/perl5/5.20/Text/VCardFast.pm line 55.

BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//CiviCRM//NONSGML CiviEvent iCal//EN
X-WR-TIMEZONE:Europe/Amsterdam
METHOD:PUBLISH
END:VCALENDAR
 at /home/mod_perl/hm/ME/CalDAVTalk.pm line 1427.
    ME::CalDAVTalk::_getEventsFromVCalendar(ME::CalDAV=HASH(0x8601578), "\x{feff}BEGIN:VCALENDAR\x{a}VERSION:2.0\x{a}PRODID:-//CiviCRM//NONSGML CiviE"...) called at /home/mod_perl/hm/ME/CalDAVTalk.pm line 2554
    ME::CalDAVTalk::vcalendarToEvents(ME::CalDAV=HASH(0x8601578), "\x{feff}BEGIN:VCALENDAR\x{a}VERSION:2.0\x{a}PRODID:-//CiviCRM//NONSGML CiviE"...) called at /home/mod_perl/hm/ME/CalDAV.pm line 1434
    eval {...} called at /home/mod_perl/hm/ME/CalDAV.pm line 1433
    ME::CalDAV::syncFromIcal(ME::CalDAV=HASH(0x8601578), "b8285308-2a18-4c47-9d22-fae8d8798d21", "\x{feff}BEGIN:VCALENDAR\x{a}VERSION:2.0\x{a}PRODID:-//CiviCRM//NONSGML CiviE"..., HASH(0x89e5670), "Force", 0, "ReadUidPrefix", "913888i-") called at /home/mod_perl/hm/ME/CalDAV.pm line 1904
    eval {...} called at /home/mod_perl/hm/ME/CalDAV.pm line 1867
    ME::CalDAV::syncCalendar(ME::CalDAV=HASH(0x8601578), 913888, "Force", 0) called at /home/mod_perl/hm/scripts/caldav_sync.pl line 271
    main::SyncCalendar(ME::User=HASH(0x89bea78)) called at /home/mod_perl/hm/scripts/caldav_sync.pl line 98

I have no idea what to make of this. There are currently no events in the calendar.

  • For google, it might just be a delay. For example if you import the file, as a file import not a feed, you need to then close google calendar and reopen it to see the event. The feed maybe takes its own time. See here where it says "add using a link" support.google.com/calendar/answer/…. It says it might take 12 hours. When you say you get an error, what error do you get? – Demerit Mar 27 at 15:57
  • i don't seem to get an error no more. but also after several days the calendar items are not loading. am i missing something obvious? what do you make of the ical-feed and its url, they're alright, right? – Sam Simons Mar 28 at 16:28
  • It looks ok, and it does import into google as a file. A crazy workaround might be to set up the feed on your phone or somewhere where it does work, then set up that calendar to sync to the google calendar. – Demerit Mar 28 at 16:37
  • I just got the error from Fastmail. Do you have an idea what to make of it? – Sam Simons Apr 8 at 11:29
  • I got a response from Fastmail. The engineers there found out that the problem is the following: "The problem is that your ics file begins with a UTF-8 Byte order mark or BOM — en.wikipedia.org/wiki/Byte_order_mark Our server did not know what to do with this, but we've fixed it and now you should be all set. I don't think it's typical to provide these in ics files, but we should have been able to handle it just the same." So this seems to be an issue of CiviCRM, I opened an issue on their Gitlab: lab.civicrm.org/dev/wordpress/issues/25 . – Sam Simons May 2 at 17:50
0

As discussed in https://lab.civicrm.org/dev/wordpress/issues/25 and using a different grep since the grep linked to in the comments above doesn't seem to work, there were two theme files with a BOM.

This grep

find . -type f -printf "%p " -a -exec od -x -N 4 \{\} \; | grep "bbef 3cbf"

located

wp-content/themes/ari/functions.php wp-content/themes/ari/header.php

0

The issue has been solved with help I got on the civiCRM repo. (https://lab.civicrm.org/dev/wordpress/issues/25).

  1. First I found two files in my site that are loaded on every page that contain a BOM.

find . -type f -printf "%p " -a -exec od -x -N 4 \{\} \; | grep "bbef 3cbf"

  1. Secondly I removed those BOMs with vim.

Edit the files (which in my case where the functions.php and header.php file of my theme) with vim. Type :set nobomb and save the files.

Now I can use the ical url of my site and it will load in virtual calendars.

  • Ha ha you might not have noticed I'm the same person, the same way you have different usernames. No worries. – Demerit May 31 at 23:11
  • Haha, thanks for your help! – Sam Simons Jun 2 at 13:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.