Open Bug 20304 Opened 22 years ago Updated 2 years ago

Export address book card/contact as vCard


(MailNews Core :: Address Book, enhancement)

Not set


(Not tracked)


(Reporter: rzach, Assigned: neil)


(Blocks 2 open bugs, )


(Keywords: helpwanted, Whiteboard: [nab-card][patchlove][gs][wip: bug 924530])


(2 files, 1 obsolete file)

AFAIK, the Palm sync utilities currently existing for Linux work on vCard files,
so being able to export the address book in vCard format would be the next best
thing to supporting address book synchronization with Palms on Linux.
Independently of that, however, it would be really nice if address book cards
could be saved to and imported from vCard files.  Also, it should be possible to
forward an address book card as a vCard attachment (select card, then
File|Forward as vCard brings up a message composition window with the adress
book card attaches as a vCard.  I think Outlook can do this).
Target Milestone: M16
QA Contact: lchiang → esther
P4 per m/n staff mtg today
Priority: P3 → P4
Mass moving to M17
Target Milestone: M16 → M17
Mass move mailnews bugs to Putterman.  Ouch.
Assignee: hangas → putterman
[FEATURE] bugs past M16 are OUT for this release.  Marking M20.  If you disagree 
with this action, please help me explain it to the PDT.
Target Milestone: M17 → M20
Moving target milestone to "future" to be reviewed at a later time
Keywords: helpwanted
Target Milestone: M20 → Future
QA Contact: esther → pmock
reassigning to chuang.
Assignee: putterman → chuang
QA-assign-to fenella.
QA Contact: pmock → fenella
The Windows version of the Palm software now supports vCard, as does the Address Book application that ships with Mac OS X.
QA Contact: fenella → nbaca
reassigning to cavin
Assignee: chuang → cavin
*** Bug 114046 has been marked as a duplicate of this bug. ***
Whiteboard: nab-card
vcard support is also needed to be able to import pine's addressbooks -
currently pine can export in vcard format, but Mozilla can not import it.
vCard is also the best way to transport addresses
from or into the following addressbooks:
- Lotus Organizer
- Outlook Express (if you are not inporting a complete OE Addressbook)
- Balsa, GnomeCard,
- etc.
It is the open standard for address data.
Attached patch First stabSplinter Review
I have a patch for this but I'll need some input from mailnews people. It
currently implements vCard v3.0, what other versions should we support (it
should be fairly easy to add other versions afaict)? There doesn't seem to be a
way to only export one adress card, do we want to be able to do that? The
"Export" feature is currently only supporting exporting the whole address book
to one file. In the case of vCards we need to save to multiple files. This
poses a challenge to the UI as depending on the format we need to let the user
select a file or a directory. I currently handle this by letting the user
select a file and save the vCard files in the same directory as that file with
the card's displayname as the filename but I don't like that solution. Input
> There doesn't seem to be a
> way to only export one adress card, do we want to be able to do that? 

Yes!!! In the "File" menu there is a menu item "Print card" which prints the 
currently selected card. I haven't used this feature yet because I don't see a 
need to print an address book card, but I very often missed a menu item "Save 
card" in the "File" menu which would save the currently selected card in vCard 

Also, it would be very helpful to have the possibility to directly attach 
vCards from the address book to outgoing mail messages (e.g. to send contact 
details from the address book to a collegue).
*** Bug 176803 has been marked as a duplicate of this bug. ***
my iPod is hot for mozilla's adress book, too!
implementation shouldn't be too difficult, other export formats already exist
(ldif, csv). couldn't the vCard export code be based on one of those?
one enhancement per bug, pls
reopen bug 114046 for forwarding card
Summary: [FEATURE] Save abook card as vCard/forward as vCard → Export address book card as vCard
It would be nice to export Vcard in order to send to users to add to their
company addressbook easily.
re-assign to sspitzer
Assignee: cavin → sspitzer
Why is Bug 176803 (can't add vcard to addressbook) marked as a duplicate of this
bug (Export address book card as Vcard).
Surely they are inverse operations ... or maybe the summary of this bug should
be changed
As vCard is an industry standard used by many applications, an import/export
function would be very important
A temporary workaround for people who want to export their contacts to vCard for
use with e.g. an iPod: export to CSV, go to, and you can convert it to a
vcf file.
*** Bug 248834 has been marked as a duplicate of this bug. ***
Product: Browser → Seamonkey
And if this enhancement is to be implemented one day, please also adds the
following points as requirements to support of vcard:
1. Context menu on an address book has one more item: "Attach as vCard"
2. Right now when I received a vCard, the context menu has the "Save Link Target
As..." item, but this isn't working.  You can't save it because the "filename"
is a URL starting as "addbook:add?...".  Maybe I should open another bug for this??
Assignee: sspitzer → mail
I needed to import LDIF and export multi-address vCard. Mozilla/TB, Palm
Desktop, OL/OE and a bunch of other stuff I tried couldn't do it. I didn't want
to get a website to parse it as the addresses are not mine to post to a website
I don't run.

KAddressBook (discovered while building a new print server from Fedora)
performed superbly. Any chance someone could look at the code and whether
something similar could be implemented in Moz/TB Address Book? Pretty please?

Blocks: majorbugs
No longer blocks: majorbugs
Is this now a Mozilla Suite only bug ? Must I create a new bug for Thunderbird ?
Assignee: mail → nobody
Component: Address Book → MailNews: Backend
Product: Mozilla Application Suite → Core
QA Contact: nbaca
Target Milestone: Future → ---
Component: MailNews: Backend → MailNews: Address Book
QA Contact: addressbook
*** Bug 327999 has been marked as a duplicate of this bug. ***
I also need a feature to export 1 to many addressbook items to a Vcard format.
I'll use this feature to export my collected items to my pda or my E-groupware server, till I'll foud a valid syncronization procedure.
I forgot something: DRAG&DROP will works fine for export as vcard, I think.
Thanks a lot.

(In reply to comment #28)
> I also need a feature to export 1 to many addressbook items to a Vcard format.
> I'll use this feature to export my collected items to my pda or my E-groupware
> server, till I'll foud a valid syncronization procedure.
> Thanks.

I hate this workaround but it works for me:
 - Install the Contacts Sidebar extension -
 - Once it's visible, right click on a contact, click "forward contact"
 - Email contact to self, once received "Save attachment" locally

Selecting several contacts produces a single "contacts.vcf" file.
Blocks: 423488
Product: Core → MailNews Core
Priority: P4 → --
The following Thunderbird addon provides vCard exports and more:

Please incorporate the code into Thunderbird or offer it as an offical Mozilla addon.
Given that both Portable Contacts and CardDAV are converging around vCard, this feels pretty important to me.  I think we want this for Tb3, and might even want to block on it.
Flags: wanted-thunderbird3+
This would be a nice feature for Thunderbird 3, especially if it could be customized by extensions to add more fields.  I did something similar for an add-on [0] in JavaScript.

A quick patch adding vCard output to the Address Book exporter; this dumps an entire directory to vCard format, and could perhaps be extended further to provide some context menu items for sending/exporting individual contacts. Bug 79709 addresses the inverse operation.
Thanks for the patch, Evan!  I'm a little confused about why it changes the vCard version from 2.1 to 3.  I was under the impression that the vCard code we have in the tree doesn't support version 3...
@dmose: if that's the case, I'll change it back - I thought perhaps someone forgot to update the version number.
Attachment #432661 - Flags: review?(dmose)
Comment on attachment 432661 [details] [diff] [review]
Patch adding vCard output to Address Book > Tools > Export.

I'm a bit leery of just exposing this feature in the default UI for two reasons: 

1) vCard v2 is now extremely dated.  I think it would be good to have some understanding of how the popular mail clients react when they're fed a list of v2 vCards (various versions of Outlook, GMail, Yahoo mail, Hotmail, before we move forward with this.  It would also be good to know exactly whom the current output is useful to and why.

2) Last I looked, LDIF was the only export format that we have where we actually do a good job of roundtripping all the data.  All the other formats have some amount of data loss.  We have no way of indicating that in the UI at the moment, which sets users up to lose data more often than they do today.

That said, if you can figure out a way to do everything in core except expose it to the UI so that an add-on could do the work of exposing it and framing expectations correctly, I'd happily accept that patch.

Assuming that you want to take a shot at this, another thing to note is that these days, we're requiring automated tests for patches in order to land in the core.  <> is a good starting point there, and people in IRC or on one of the mailing lists can you help you figure out stuff that isn't documented...
Attachment #432661 - Flags: review?(dmose) → review-
Fair enough; didn't realize our vCard support was *that* shaky. The updated patch removes vCard export from frontend, while exposing a new exportDirectory() method in nsIAbManager; this exports the directory to a string, so that exportAddressBook() wraps this to dump that string into an nsILocalFile. It also adds an xpcshell test for export to CSV, tab-delimited, and vCard formats. Let me know if this is a sensible direction to take :)
Attachment #432661 - Attachment is obsolete: true
Attachment #435264 - Flags: review?
Attachment #435264 - Flags: review? → review?(dmose)
Would it be that hard to support vCard v3 (and maybe even roundtripping)?

The lack of vCard-support (including UI!) is really embarrassing, given that every phone I have (wireless, mobile, IP) supports it and it was the only way to get my contacts there. I had to use KMail for ldif -> vcard conversion! :(
(In reply to comment #40)
> Would it be that hard to support vCard v3 (and maybe even roundtripping)?

That conversation would probably be better in bug 221991 or on tb-planning. However, the main issue that our current vcard code is based on yacc generated code, it is not simple or easy to modify and it should just be rewritten anyway. We've considered using a third-party library in the past but iirc never found a suitable one (and obviously no-one's stepped up to rewrite it).
Is abny kind of vcard support going to make it into the next version?  I've got 3.2a at the moment (David Bienvenu's test version) and it doesn't have vcard export of address book.

The need I'm working with is exporting VCARDS so they can be imported into OSX Address Book (since the OSX Address Book integration is unfortunately read-only - i.e. you can't add addresses to the OSX Address Book from TB) - going via vcards would be the easiest way.
I don't think we really know at this point; we're still pretty heads down on 3.1, and 3.2 doesn't really have any definition around it yet.  

For the problem you're caring about, you might to take a look at Contacts add-on port to Thunderbird described in various blog entries at <>.  It may not actually be helpful to you, but it does do a bunch of addressbook manipulation, and natively thinks about things in Portable Contacts format, which should (from a data model standpoint) be fairly compatible with vCARDs, and it's possible you could chain something together based on that code in combination with something else.
Thanks - but "Contacts" (especially since its in pre-alpha) seems like a really complicated / heavy way to deal with a fundamental ommission in TB.
Summary: Export address book card as vCard → Implement exporting address book card/contact as vCard
Summary: Implement exporting address book card/contact as vCard → Export address book card/contact as vCard
Comment on attachment 435264 [details] [diff] [review]
updated patch for vCard export

We're sorry for the big delay in getting to this.

Looking at the patch, I don't think that returning a string is really appropriate. We should already have other methods to get a vcard as a string, and this is just ending up as a wrapper for multiple, which I don't think is really appropriate for a function called exportDirectory.

I think what I'd prefer is to change the existing exportAddressBook to something like this:

void exportAddressBook(in nsIDOMWindow aParentWin, in nsIAbDirectory aDirectory, [optional] in long aExportType, [optional] in nsIFile aFileName);

aExportType and aFileName would both be optional arguments that an extension could supply together, which would skip the file dialog and save directly to the specified file in the format required.
Attachment #435264 - Flags: review?(dmose) → review-
Flags: wanted-thunderbird+
Whiteboard: nab-card → [nab-card][patchlove]
Blocks: 533297
Blocks: 114046
Whiteboard: [nab-card][patchlove] → [nab-card][patchlove][gs]
Assignee: nobody → neil
It seems to me this depends on bug 924530.
(In reply to Sylvhem from comment #47)
> It seems to me this depends on bug 924530.

Thanks, indeed. Bug 924530 seems same as this one, so fixing that will fix this.
Depends on: 924530
Whiteboard: [nab-card][patchlove][gs] → [nab-card][patchlove][gs][wip: bug 924530]
can we close this as fixed?
You need to log in before you can comment on or make changes to this bug.