Using a combination of CCK, Views, FeedAPI, FeedAPI Mapper, Date, Calendar, and the iCal parser, you can create a view of events from an iCal feed (or multiple iCal feeds).

Much of this is copied from the Advanced help in the latest -dev version of the Date module, which you can see if the Advanced help module is installed. Also make sure you have the latest -dev code for the Date module, too.

Also, In order to do this, you'll need to install the iCal parser module. Make sure you have updated to current Calendar, Date, and FeedAPI modules.

  1. Enable the following modules and sub-modules: CCK, Calendar, Calendar iCal, Date, Date API, Date Timezone, FeedAPI Mapper, iCal parser, FeedAPI, FeedAPI Node, Views, Views UI.
  2. Decide what content type will be used for nodes imported from your iCal feed. It can be a separate content type for each feed, or they can be combined into other content types. Make sure the content type you select has a date field that can be used for the iCal date, plus fields for any other iCal information that will be imported.
  3. Create a new content type for iCal feeds. Do not simply add iCal processing to the existing Feed content type. You need to create new content type for iCal feeds on a content type that has no other parsers enabled. Make sure that "Refresh feed on creation" is unchecked. Under "FeedAPI", check that this is a content type for downloading feeds to your site. Scroll down and under "Parser Common iCal Syndication", check that you want to enable the ical parser for this feed. Under "FeedAPI Node", check the box to enable the feedapi_node processor on this feed and make sure the content type from Step 2 is selected.
  4. Go to 'Create Content' and create a new node using the iCal feed content type. When you create the node, you will find a place to input the url of the feed and make sure the content type from Step 2 is selected.
  5. Once the feed node has been created, you will see a tab at the top where you can 'map' its data to the fields in your target content type.
  6. Scroll way down and look for "options->VEVENT:" and map options->VEVENT:DATE to "field_**** (date**): iCal VEVENT" (the date field in your feed item content type).
    Do NOT map any other "options->VEVENT:DATE" fields. Start, end, and repeating rule will all be transferred automatically.
    You may map non-VEVENT fields to other fields in the target node. Scroll over and click "Add."
  7. Once mapped, you can click on the 'Refresh' tab to add in the new feed items.
  8. You can check the Content screen in the administration area to see that the nodes have been imported.
  9. Now, if your interested, you can use Views to setup a calendar view of all the items from your feed. It's probably easiest to simply clone the default calendar view. You can do this in the Views UI.
  10. Within the settings page for your new view, add a Filter for 'Node: Type' and choose the content type that your iCal feed is creating. If you didn't use a separate content type for your iCal feed, you will need to find another way to filter out the feed elements, unless you want to show more than just the feed items.
  11. Under Arguments, you will need to set a 'Date: Date' argument. If you cloned the default calendar view, then you will need to modify the Date Argument that's already set. In the Arguments settings, select a date field filter with the argument. Do not select both the 'From date' and 'To date' for CCK date fields, only one of them is needed.
  12. Besides any other adjustments you might want to make, your view should be setup.

Note: The following attachments are screenshots provided at: http://drupal.org/node/214688

AttachmentSize
configure_content_type.jpg109 KB
ical_feed_map2.png17.7 KB

Comments

pdcarto’s picture

Step 6 says

Scroll way down and look for options->DTSTART: and options->DTEND and map them to the 'From date' and 'To date' fields.

However in the discussion "Create a CCK date field mapper", comment @ #112, KarenS
says

When mapping ical items you just map the top-level ical VEVENT item to the matching date item (also called VEVENT to make it easy to see). You do *not* map all the individual parts of the ical element, like 'all_day', just the one top-level element. This is because the ical element has lots of interacting parts and the mapper can't do anything meaningful with the date without the whole thing.

Is it time to update this page, or at least include a pointer to the CCK date field mapper discussion?

claar’s picture

FeedAPI has been replaced by Feeds -- this whole article needs reworked to describe the new process.

mgifford’s picture

Agreed @claar - especially since it doesn't look like there is going to be a Feed API release for D7.

brush’s picture

Step 1 should remind admins to update permissions to allow admin (and maybe others) to use the various modules and features.

at02’s picture

I'm working my way through this, but I have to admit I'm not extremely Drupal savvy. This may be a silly question, but what exactly is meant by "URL of the feed" in step 4? I get everything else, but at that point I enter what I thought was the feed URL and it doesn't work.

gilcreque’s picture

The "URL of the feed" is the link to the .ics file. This needs to be hosted on the internet somewhere. If you are using Google Calendar you can find the link to the .ics file in calendar settings. When you go the the calendar settings page you'll see a green icon that says ICAL. Right click and pick copy link location and paste it into that field.

at02’s picture

That is what I thought. I'm trying to make a feed of CiviCRM events so that they will be displayed on the calendar. I figured that the green "ICAL" icon was the necessary link, however everytime I put that into the field for "feed url" I get this error:

"Fatal error: Call to undefined function link_content_is_empty() in /sites/all/modules/cck/content.module on line 900"

and then the page never loads. Could I have done something wrong or messed up one of the previous steps?

emilyf’s picture

@at02 and anyone else wanting to do this with CiviCRM, there is a civi forum post detailing how to do this...start at this comment, but make sure to read everything after it as more information is provided: http://forum.civicrm.org/index.php/topic,8667.msg37439.html#msg37439

jakemonO’s picture

It's not clear to me how to make recurring or multi-day events (primary concern is multi-days) display properly in a calendar view. Also, how would one just break out the time component of the vevent field so as to just show the time of the event in the appropriate date cell of a calendar view? If this is do-able, please update this (excellent) recipe. -Thanks

Summitt Dweller’s picture

Tried this process some time ago to pull iCal data from HighSchoolSports.net. I have reason to try it again.

Now, when I follow the process I never see any option corresponding to "Parser Common iCal Syndication". All the other fieldsets seem to be present and make sense.

When I create a node of my new iCal feed type the URL doesn't "stick" (if i come back to edit it later the URL is always gone). And in the mapping step I get a list of only 4 possible items to map (options->tags, options->author, etc.), and none of them relate to options->VEVENT.

Anybody venture a guess as to what's wrong? Thanks in advance.

UPDATE: Tried this approach on a pristine site and installation of Drupal and it works much better. Trying now to determine just what the key differences are.

Yasl’s picture

I had this working last year for High School Sports. After upgrading to 6.13 this summer and other updates... nothing seems to work. It says 14 nodes created but only three show as new nodes (interestingly it's varsity, junior varsity and frosh rather than a couple varsity and a jv). :( (14 is the correct number however)

Have you had any luck?

CheezItMan’s picture

When I finish mapping the fields and refresh the feed, hoping to see the events populate in Drupal. I just get the white screen of death, no text no nothing. Most importantly no nodes created.

Any idea what's up?

I just go to this page: node/4/refresh

and get nuthin.

I mapped options->VEVENT to the iCal event

I mapped the title and description to node fields.

I'm using the Aquia Drupal Distribution.

pheidrias’s picture

Hello together!

Besides the problem, that drupal always adds the URL of my page in front of the wanted ics-URL, after editing the in 4. created node (resulting in something like "mysite.commysite.commysite.com/webcal://pathtofeed" after several edits) - so I had to download an ics-feed-file and insert the correct path each time ("/calendar.ics"), I'm stuck at point 5.

There is no "map"-Tab arising. Where should it be? I only have "View", "Refresh", "Remove Items" and "Edit?".
Also after doing a refresh, there is no other tab "map" arising.

At least I do get some nodes from the ical-file.

What may be my problem?

Thanks,
pheidrias

robert.oconnell’s picture

You need the feed api element mapper module: http://drupal.org/project/feedapi_mapper

jbcbirder’s picture

I can't seem to find this Module by searching for it in "modules". Actually I see it referenced in the comment above mine. A link in the instructions might be helpful. Alternately change the name reference as it appears to be called “Feed Element Mapper” though I see that the developer of that module is likely responsible for that discrepancy.

MichaelP’s picture

Seems obvious after the event, but perhaps it should be clarified between 4 and 5 that unless a valid ical url is input and the node saved, the mapping will not show up the data fields of the source feed to be mapped.

Korinvall’s picture

I have a Google-iCalfeed-to-FeedAPI set-up working just fine right now. But I'm wondering if there's an existing tool for auto-deleting the relevant Drupal nodes that have been deleted in the feed.

I see that you can kill feed items after a certain period of time (available in a drop-down in both the Feed content type and instances of created feeds from that content type).

But I'm thinking somewhere in the update/refresh process there could be a node-to-feed comparison with the orphaned nodes (those which no longer have a corresponding feed item) being deleted (or at least unpublished).

Maybe a workflow tool?

Thanks

dkabal’s picture

Me too. I am similarly using the Google-iCal feed-FeedAPI system. I would like this functionality as well (why are adds and changes respected in the source feed, but not deletes?).

Thanks,
Dave

donquixote’s picture

#451888: TimeZone wrong for UTC iCal data
The patch proposed in this issue #1 worked for me.

anyr’s picture

Thank you for the guide, this works so well!

I have 180 (past) events to import and it times out after 50 or so - is there a way to set it to import different events each time?

alexmc’s picture

I'm building a Drupal site for a team which already uses Google Calendar. Since there is no reason to change their habits will this work for them? There are other Google Calendar modules which don't use ical - so I am a bit confused as to which is best.

alexmc’s picture

> make sure you have the latest -dev code for the Date module, too.

I find this unprofessional and worries me alot. If the Dev code is ready for use on production systems then make a release!

alexmc’s picture

I got as far as item six above but then couldn't proceed...

> Scroll way down and look for "options->VEVENT:" and map options->VEVENT:DATE

I have nothing which looks like the image attached to this article. I have a section "Mapping" with "Feed Item", "Node", and Add.

Under Feed Item I have

options->original_author
options->tags
options->original_author->name
options->original_author->picture

(But on the node side I *do* have the Map to field_date (date): ICal VEVENT)

alexmc’s picture

SOLVED.

I think I hadn't got the ICal Parser working so it was not reading the ICal file correctly - and thus didn't know what fields were in there.

michael.sanborn’s picture

I'm new to Drupal, but I've gone through both this document and the "iCal Events as Nodes" video. I'm able to import all the events from my Google Calendar to my Drupal calendar, but they show up all in a bunch on today's date.

I've tried mapping 'options->VEVENT->DATE' (as it says here) and 'options->VEVENT' (as it says in the video) to 'field_**** (date**): iCal VEVENT' with no luck.

I'm using Drupal 6.17 with iCal parser 6.x-1.1, Calendar 6.x-2.2, and FeedAPI 6.x-1.8.

What am I doing wrong? Can anyone help me with this?

Thanks in advance.

symbolgen’s picture

I have tried every setting I can think of and all my calendar events are added to the same day also.

If I look at the content nodes that are created in the content list (for the google calendar items) the dates are correct on the nodes. Somehow the calendar is not importing them correctly and assigning them to the correct days.

cecemel7’s picture

Hello symbolgen,
I'm a newbie to Drupal but I've been struggling with date and all that stuff for nearly a week now. I've had the same problem. It's a view problem.
You have to go to site construction >> views >> list,
find the calendar view you're using (the default one or a copy of it)
click edit
on the default page (the one you should be in) , you have to set some things right (there is a certain order for that, I don't remember, there is a really good tutorial about that somewhere, if I find it I post it) :
In FIELDS : you have to add Content : Date Start Date (you can exclude it from display but it has to be there).
In ARGUMENTS :
Remove the one that is there
Then click on '+' and choose Date : Date (node)
On the next screen find something like Content : Date (field_yourdatefield) Start Date
Hope it helps you.

By the way, I still have a lot of problems with my GCal Import : incorrect TimeZone handling, big problems with all-day events not having a end date,... and I see I'm not the only one. I tried to use the -dev version of the date module (not sure it is a good idea) but it doesn't seem to make things better... If someone has an up-to-date how-to tutorial with all the good versions of all the modules implied, his or her help would be greatly appreciated :-)

fox’s picture

I have this set up and it is working well but if I have a repeat event in google with more than 52 occurrences, only the first 52 are imported.

Is this an expected limitation, or is there a setting somewhere?

zakir.gori’s picture

Using CCK, Views, FeedAPI, FeedAPI Mapper, Date, Calendar, and the iCal parser, modules i want to embed all my google calender event into my Drupal website but not got any success after 8 hr. i saw following video:
http://mustardseedmedia.com/podcast/episode27 for calender configuration
http://mustardseedmedia.com/podcast/episode34 for ical google calender embed into event.
I've tried mapping 'options->VEVENT->DATE' (as it says here) and 'options->VEVENT' (as it says in the video) to 'field_**** (date**): iCal VEVENT' with no luck.

The problem is all ICal event is coming into same date that is 22/10/2011. i don't know why?
can anybody will help me thanks in advance.

zakir.gori

lebachai’s picture

I'm having the same problem and was hoping you might have figured out the issue.