Notice: With the launch of Adobe Cookbooks, this site will no longer be accepting new entries or posting new content. Thanks to everyone who submitted content!

How do I create a vCard/ vCalender link and have it download to MS Outlook?

Use <cfcontent> and <cfheader> to set the appropriate MIME and header types, then include the appropriate fields and data. If MS Outlook is installed on the client, it will receive the data as a vCard!

The following sample static vCard was found out on the internet. It can be used as a template to replace with your own dynamic data.

<cfcontent type="text/x-vCalendar">
<cfheader name="Content-Disposition" value="inline; filename=newAppointment.vcs">
BEGIN:VCARD
VERSION:3.0
N;charset=iso-8859-1:Geuzaine;Christophe
BDAY;value=date:1973-02-06
EMAIL;type=HOME:geuz@geuz.org
URL;type=HOME:http://www.geuz.org
TITLE;charset=iso-8859-1:Postdoctoral Scholar
ORG;charset=iso-8859-1:Caltech, Applied and Computational Mathematics
ADR;type=WORK;charset=iso-8859-1:;;1200 E California Blvd;Pasadena;CA;91125;USA
TEL;type=WORK:1 626 395 4552
URL;type=WORK:http://www.acm.caltech.edu
END:VCARD
BEGIN:VCARD
VERSION:3.0
N;charset=iso-8859-1:Knudson;Donald Ernest
BDAY;value=date:01-29
TEL;type=HOME:+01-(0)2-234.56.78
EMAIL;type=HOME:duck@novosi.uni.gnu
NOTE;charset=iso-8859-1:1952 Permafrost Press Award winner
END:VCARD
BEGIN:VCARD
VERSION:3.0
N;charset=iso-8859-1:Knudson;Daffy Duck (with Bugs Bunny and Mr. Pluto)
NICKNAME;charset=iso-8859-1:gnat and gnu and pluto
BDAY;value=date:02-10;11-05;01-01
TEL;type=HOME:+01-(0)2-765.43.21
TEL;type=CELL:+01-(0)5-555.55.55
ACCOUNT;type=HOME:010-1234567-05
ADR;type=HOME;charset=iso-8859-1:;;Haight Street 512;Novosibirsk;;80214;Gnuland
TEL;type=HOME:+01-(0)2-876.54.32
ORG;charset=iso-8859-1:University of Novosibirsk, Department of Octopus Parthenogenesis
END:VCARD
BEGIN:VCARD
VERSION:3.0
N;charset=iso-8859-1:Knudson;Bip B.
NICKNAME;charset=iso-8859-1:road runner
BDAY;value=date:02-27
ADR;type=HOME;charset=iso-8859-1:;;Somewhere close to a falling rock;;;;
EMAIL;type=HOME:bip_bip@free.prov.gnu
END:VCARD
BEGIN:VCARD
VERSION:3.0
N;charset=iso-8859-1:Microknud Corp.;
ADR;type=WORK;charset=iso-8859-1:;;Haight Street 513;Novosibirsk;;80214;Gnuland
TEL;type=WORK:+01-(0)2-465.83.99
TEL;type=FAX:005.79.00
URL:http://foo.com/index.html
END:VCARD
BEGIN:VCARD
VERSION:3.0
N;charset=iso-8859-1:The Knudsoft Company;
EMAIL:knud@knudsoft.com
URL:http://foo.com/index.htm
END:VCARD
BEGIN:VCARD
VERSION:3.0
N;charset=iso-8859-1:Knudsoft (RS.2 Computer Room);
TEL;type=WORK:+01-(0)2-434.23.23
END:VCARD


This question was written by Jeremy Petersen.
It was last updated on June 2, 2006 at 5:31:52 PM EDT.

CFML Referenced

<cfheader>
<cfcontent>

Categories

Miscellaneous

Comments

Comment made by RobW on January 26, 2007 at 10:29 AM
The example works for creating a vCalender, but in order to create a vCard, you need to change the first two lines to: <cfcontent type="text/x-vcard"> <cfheader name="Content-Disposition" value="inline; filename=newContact.vcs">


Comment made by Steve Glachan on February 13, 2008 at 1:50 AM
I found this Wiki write-up very helpful when I was working with this sort of thing:

http://en.wikipedia.org/wiki/VCard


Comment made by TroyP on March 13, 2008 at 3:48 PM
This UDF vCal() is very helpful too. http://cflib.org/udf.cfm?ID=385


Comment made by Mo Hadi on March 21, 2008 at 6:45 PM
Any chance something similar can be created for an email distribution list which could be imported into Outlook? I am trying to pull data from database based on user's criteria. Once the data is pulled, I want to make a distribution list that the user can import into their outlook.