[Vobject] Re: vobject to create a simple vCard

Jeffrey Harris jeffrey at osafoundation.org
Sat Feb 18 12:39:39 CST 2006


Hi Loïc,

> Parsing works perfectly, but when
> I want to create for example an adr
> 
> card = vobject.vCard()
> card.add('fn').value = 'Full name'
> card.add('n').value = 'name'
> card.add('adr').value = 'my address'
> card.serialize() <- does not work
> 
> If you have somewhere a little piece of code to create a vcard, I would
> be very pleased. You can simply redirect me to a chandler piece of code,
> that would be fine.

You're right, I need to add vCard examples to the documentation (just
yesterday I finally wrote some, see
http://vobject.skyhouseconsulting.com/usage.html, but there's nothing
with vCard in there).

Oh, I just released 0.3.0, for folks using releases and not SVN.

The problem with the above is that in vCard, N and ADR are structs, with
a variety of specific fields.  To create these, have a look at:

http://vobject.skyhouseconsulting.com/epydoc/public/vobject.vcard.Name-class.html#__init__
http://vobject.skyhouseconsulting.com/epydoc/public/vobject.vcard.Address-class.html#__init__

I'll write some examples for this soon.

Just to be clear, I'm not at all attached to what Name and Address
objects should look like or how they should behave.  I just copied the
vCard fields.

Sincerely,
Jeffrey


More information about the VObject mailing list