Create a feed of iCal events using Date, FeedAPI, and iCal parser

Last modified: August 8, 2009 - 11:39

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

Updating needed

pdcarto - March 30, 2009 - 12:49

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?

Remember to update Permissions

brush - April 28, 2009 - 00:20

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

Which URL

at02 - May 22, 2009 - 15:53

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.

The "URL of the feed" is the

gilcreque - June 3, 2009 - 06:18

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.

That is what I thought. I'm

at02 - June 5, 2009 - 13:04

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?

how to do this with civievent feeds

emilyf - July 15, 2009 - 15:19

@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

calendar

jakemonO - July 30, 2009 - 12:56

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

Trying this Again

Summitt Dweller - August 7, 2009 - 14:05

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.

High School Sports

Yasl - August 26, 2009 - 19:57

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?

No Refresh

CheezItMan - August 8, 2009 - 06:35

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.

---
Chris McAnally
SCIS Technology Director

Step 5 --> Where is the "Map TAB"?

pheidrias - August 23, 2009 - 10:47

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

You need the feed api element

robert.oconnell - September 19, 2009 - 04:18

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

FeedAPI Mapper

jbcbirder - October 6, 2009 - 02:53

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.

url of the feed

MichaelP - October 9, 2009 - 13:42

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.

Automated deletion of FeedAPI+iCalParser generated nodes?

cacody - November 10, 2009 - 14:25

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

 
 

Drupal is a registered trademark of Dries Buytaert.