Table of Contents

VCards and Citadel

Migrating LDAP data and Outlook VCards to citadel

- by Larry Ives

Credits - Thanks to D. Scott Barninger for his perl module which converts ldif to vcard. … Thanks to IGnatius T Foobar and dotherbart for coaching me and pointing me in the right direction. Also thanks to the coder(s) of the ctdlphp sample application for hint on the proper use of ENT0 and the Content-type. (refer to Citadel Support - search for ctdlphp)

Solution - I used a combination of slapcat, Thunderbird, and perl to export and import the records.

LDAP migration - used slapcat to export my LDAP addresses. Used Barninger's perl script to convert them to vcard format. Use my script to import them. BTW, use the script I wrote at your own risk. I installed a test environment of Citadel on a Debian platform to do the testing. My perl script is real down and dirty and only does the one thing, imports vcards into Citadel. (the script is listed at the bottom of this note)

Outlook migration - use Thunderbird to import your Outlook contacts and then export them to ldif format then use Barninger's perl script to convert to vcard and my perl script to import them into Citadel Personal Folder/Contacts.

The script - You will need to get the Net::Telnet module and all of it's dependencies. Simply change the variables in lines 8 through 11 to suite your desires. Also make sure the last line of the import file is not a blank line. It will still work with the blank line but will hang until the Telnet session times out.

#!/usr/bin/perl -w
use strict;
use Net::Telnet ();
my ($s);
my $t = new Net::Telnet;
my $user = 'admin';
my $pass = 'xxxxxxxx';
my $fl = 'vcard';
my $target = 'Global Address Book';
$t->open(Host => 'localhost', Port => 504);
$s = $t->getline;
$t->print("USER $user");
$s = $t->getline;
$t->print("PASS $pass");
$s = $t->getline;
$t->print("GOTO $target");
$s = $t->getline;
$t->print('ENT0 1|||4');
$s = $t->getline;
$t->print('Content-type: text/x-vcard; charset=UTF-8');
open(IN, "<$fl");
while (<IN>)
 if (/^$/)
  $t->print('ENT0 1|||4');
  $s = $t->getline;
  $t->print('Content-type: text/x-vcard; charset=UTF-8');
  if (/FN:/)
   my @name = split(/:/,$_);
   print "Adding $name[1]";

Exporting Citadels Global Address Book to a Outlook contact file(.pst)

- by Danboid

First, lets create a folder to contain the vcard files:

mkdir ~/contacts

Change directory into the folder you just created:

cd ~/contacts

If you haven't already done so, you will need to have cadaver groupdav client installed to download the vcards like so, replacing with the address of your citadel server:

cd "Global Address Book"
mget *

Now you should have as many vcard files as users on your Citadel system contained within ~/contacts. Next we need to combine all these vcards into one .vcf file because .vcf files can store multiple entries but kaddressbook can only import one .vcf at a time. Whilst you are still in the contacts folder, run:

cat * > contacts.vcf

If you don't already have kaddressbook installed, install it now. kaddressbook is part of the KDEPIM (Personal Information Management) suite of applications and is totally free. Use its 'Import Vcard' menu option to import your contacts.vcf file then export your contacts to a .csv file that we'll call 'unixcontacts.csv'. We have named it so because this is a unix formatted text (.csv) file which Outlook will choke on if you try importing it in its current state so our next command converts unixcontacts.csv into a Windows/ Outlook friendly contacts.csv file:

awk 'sub("$", "\r")' unixcontacts.csv > contacts.csv

Once you have your Windows- formatted contacts.csv file, you can copy this to your Outlook machine and start Outlook's 'Import and Export' wizard. First choose 'Import from another program or file' then 'Comma Separated Values (Windows)'. Point it towars your contacts.csv file and tell it to place the new Contacts in your Outlook Contacts Personal Folder. On the next screen ('Import a file') you must click 'Map Custom Fields' as otherwise Outlook will not extract the csv data correctly. If you look at the contacts.csv file under a text editor or spreadsheet you will see there are many unused columns of data so we only need to make sure the ones that have been used get mapped. With the csv column names on the left and Outlook contact details on the right, I mapped the csv data like so:

Formatted Name | Name / First Name

Honorific Prefixes | Name / Title

Home Phone | Other Address / Home Phone

Business Phone | Other Address / Business Phone

Email Address | Email / Email-Address

After mapping all the custom fields you require (which may well be more than I've listed above) you should have all your Citadel contacts imported into Outlook and so exporting them to a .pst is now as simple as using 'Export to a file' under the Import and Export wizard, which is a self- explanatory process.

- Editors note: you can also use the Bynari connector if you prefer.