[Vobject] vcard subcomponents

Jeffrey Harris jeffrey at osafoundation.org
Mon Apr 7 16:53:42 CDT 2008


Hi Nick,

> What I'm trying to do is turn gmail's contact cards into vCards.

Ah, OK.  Is there a reason you aren't using gmail's built in export to 
vCard feature?  I'd be delighted to see a Python implementation that 
turns GData contacts 
(http://code.google.com/apis/gdata/elements.html#gdContactKind) into 
vCards, is that what you're working on?

> A gmail contact has a name, an email address, a multiline note, and
> then a list of extra contact information which is a name ("Personal",
>  "Work" etc) and then pairs (type, value) where type is like 'email',
>  'phone', 'IM' etc. and value is just some single line. I figured I 
> would use a subcomponent for each set of extra things. The way I 
> originally wrote the code (with with having c.add('personal').value =
>  subcomponent) was because I figured each subsection is named, and
> then has subpieces.
>
> How would you all arrange this? Am I using vCards right or do I have 
> some misconception about them?

Many, though not all, of these things map naturally to a vCard 
content-line, in these cases I don't think you want a custom 
sub-component.  Generally speaking, I think it's worth mapping to 
"standard" vCard content-lines whenever possible, because it's then 
possible for other implementations to read the card.

The problem with custom sub-components is that no application (other 
than your own) is likely to read them.  That's why this problem with 
custom subcomponent hadn't come to my attention yet; I don't use them :)

Of course, it's a lot more work to map fields based on your 
understanding of what's intended.  My suggestions might be more accurate 
if I knew in more detail what you're hoping to achieve.

Sincerely,
Jeffrey


More information about the VObject mailing list