exporting mozilla contacts to evolution
05:37pm EDT, 26 Sep 2003
So about 14 months ago, I converted George from win98 to Linux. He used Outlook for his mail app, so I figured he should use Evolution. Before we converted him, I did some research on converting Outlook contacts into Evolution format, and it turned out to be easier said than done.
I just wrote a script that does what the title of this article says, but first let me rant a little.
First I made a csv file in Outlook itself, and then I found a howto that entailed importing the contacts into Mozilla while still running Windows, and then export them to "LDIF" which could then be imported into Evolution.
Well, he had Outlook 97, so the csv file we made was no good at all in Evolution. Not even the names came up right. "Uh oh," I thought, and went on to plan B.
All the contacts displayed fine in Mozilla, but when importing the Mozilla ldif file into Evolution about half of the fields were lost, and some fields were mangled (e.g. if your address was "123 Court St. Fairport NY 14450" your address would become "NY 14450" and the city and state fields would be blank.) Faced with the prospect of entering a hundred contacts by hand, we just decided George could use Mozilla as his address book. And that's where things have been for the last year. Unfortunately, it sucked.
Lately I've been doing some work with ldap (my goal is to get us both up and running on a shared contact folder on an ldap server) so LDIF files aren't total nonsense to me anymore. It seems the trouble with what I'm doing is that, while mozilla exports an LDIF file, most of the fields are mozilla custom fields whose names start with "mozilla", and those are ignored by evolution. I finally got the bright idea to correct the broken fields on a couple records, export them to VCF files (the ONLY format you can export from evolution!) find out what Evolution thinks the fields should be called, and write a perl script to convert Mozilla's flavor of LDIF into Evolution's flavor of VCF.
Amazingly enough, it worked. Here it is: mozldif2vcf Feel free to use it as you like, embellish it to include fields we didn't use in our 100-odd contacts, whatever. It sure would be nice if Evolution were smart enough to see mozilla fields and convert them appropriately, but there's a strong air of "not invented here" syndrome that permeates a lot of corporate backed free software projects (and a lot of non-corporate backed ones as well) that's hard to dissipate except via public ridicule. I'd usually rather fix things when I can than ridicule them, so here you go.
back to main