Brian Dunning's FileMaker Custom Functions

vcard ( FirstName ; LastName ; Org ; Title ; Phone ; Fax ; Mobile ; Email )

Returns text formatted as a vCard

  Average rating: 3.4 (69 votes) Log in to vote

Chris Pye   Chris Pye - Show more from this author
Mactec
http://www.mactec.com.au

Share on Facebook Share on Twitter

  Sample input:
vcard ( "Fred" ; "Bloggs" ; "F Bloggs & Co" ; "Mr" ; "0754 321 789" ; "0754 321 799" ; "0413 284 343" ; "fred@bloggsco.net" ; "1 Test Lane" ; "Suburb" ; "State" ; "5035" ; "Fredland" )
  Sample output:
BEGIN:VCARD
VERSION:2.1
N:Bloggs;Fred;;Mr;
FN:Fred Bloggs
ORG:F Bloggs & Co;
TEL;work:0754 321 789
TEL;fax:0754 321 799
TEL;cell:0413 284 343
EMAIL;INTERNET;work:fred@bloggsco.net
ADR;work:;;1 Test Lane;Suburb;State;5035;Fredland
END:VCARD

  Function definition: (Copy & paste into FileMaker's Edit Custom Function window)

Creates a vCard from contact fields.

I created this function as simple and portable way of exporting vCards from any Filemaker solution. This function takes contact info and formats it into the vCard format as text. The result field can be exported as tab separated text and saved with the .vcf file extension which can then be opened in the Apple Address Book and other software that supports the vCard format.

Please note that you need to use the "Export Field Contents" script step to maintain the returns at the end of each line. Using export record will strip the returns, and the vcard file will not open.

I started off thinking that this function should be kept simple, but then I thought it might be easier to delete unwanted fields rather than adding them latter.

 

Comments

Stan   Stan, Ottawa/ON
Dec 8, 2009
do you have example to supply multiple addresses from the File Maker ?
 
Peter Neal   Peter Neal, London
Aug 28, 2010
If you want to add the BDAY to the custom function you must remember that your date field has to be exported as text and that text has to be formatted as: YYYY/MM/DD otherwise it will not work when added to Address Book.
 
Eric   Eric, SJSU
Apr 9, 2012
I have pasted the script into custom functions, and changed the appropriate field names, but I am confused as to the next step. Where do I incorporate this into a script step?

I only wanted to export a found set of records as vcard, but getting stuck...

Thanks.
 
Christophe Duchâtel   Christophe Duchâtel, Etoy, Switzerland
Jun 15, 2012
I have pasted the script into custom functions, and changed the appropriate field names, but I am confused as to the next step. Where do I incorporate this into a script step?

I only wanted to export a found set of records as vcard, but getting stuck...

Thanks.
 
Chris   Chris, Brisbane, Australia
Jun 17, 2012
There is a better method on my blog: http://www.mactec.com.au/archives/283

I will allow you to export a vcard for multiple records, and related fields.
 
Rick Altman   Rick Altman, Pleasanton
Jul 30, 2012
This looks terrific -- the logical next step is to support the creation of a QR code. Has this been done yet, by this developer or any other? I am aware of QR code generators from within FileMaker, but none that supports the creation of a VCard.
 
Dan Shockley   Dan Shockley
Feb 25, 2013
For QR Codes, you can generate them using some URI-based QR Code generator site and a FileMaker web-viewer. Google Charts can do this, but I believe they plan to discontinue that API. Another site is http://qrserver.com/api/ -- I don't know how well it works, but that's an example. Check their Terms, they might charge for commercial use.
Here's an example call to generate a QR Code for the data 'Example':
http://api.qrserver.com/v1/create-qr-code/?size=150x150&data=Example
 
Guillermo   Guillermo, Sevilla/Spain
Jul 11, 2013
Although implementing is somewhat tedious, the function works like a charm. I get a text field with an exact copy of the vCard content. Using normal text output (Export Field Content, Export Record), you get a .vcf file, eventually with a calculated file name. Unfortunately this file is rather useless, due to the UTF-16 encoding, and the file will not be recognized as a guilty 'Business Card File' (http://fmforums.com/forum/topic/65726-ascii-polution-in-text-exports/)

Even if FM is obviously produced exclusively in order to fuel up the Filemaker CEO's private jet, the BIG FILEMAKER WORKAROUND BOOK, about 4 billion pages, and St. Google will give you the solution. (http://simoncpage.co.uk/blog/2008/08/filemaker-to-vcard/).

Thus generated vCard sent from your device to a mobile device by bluetooth will do the job perfectly.

Thanks to Chris and Briandunning
 
Gary   Gary, GC Consulting
Nov 6, 2013
Fantastic, works well. How do I add "notes"?
 
Gary   Gary, GC Consulting
Nov 7, 2013
I got it to put a note into Contacts but it would not work if there was more than one line of notes gary@behealthy.com.aubehealthy.com.au
 
BrittBerri   BrittBerri, Llanteg
Jan 19, 2015
You actually make it seem so easy with your presentation but I find this topic to be actually something that I think I would never understand. It seems too complicated and very broad for me. I am looking forward for your next post, I will try to get the hang of it!
 
angelinaul   angelinaul, Acquafredda
May 27, 2015
I have read some good stuff here. Definitely value bookmarking for revisiting. I surprise how much effort you place to make this type of fantastic informative site.
 

Log in to post comments.

 

Note: these functions are not guaranteed or supported by BrianDunning.com. Please contact the individual developer with any questions or problems.

Support this website.

This library has been a free commmunity resource for FileMaker users and developers for 20 years. It receives no funding and has no advertisements. If it has helped you out, I'd really appreciate it if you could contribute whatever you think it's worth: