[Vobject] Adding multiple addresses of different types

Jeffrey Harris jeffrey at osafoundation.org
Sun Oct 11 12:00:32 CDT 2009


Hi Adam,

> adr = vobject.vcard.Address()
> adr.city = address.city
> ...
> card.add('adr').value = adr
> 
> But I need to add multiple addresses to the vCard of different types,
> like -
> 
> ADR;TYPE=OTHER:;;9999 Monroe Ave NW;Grand Rapids;;12345;USA
> ADR;TYPE=WORK:;;9999 Monroe Ave NW;Grand Rapids;;12345;USA
> ADR;TYPE=HOME:;;9999 Shirley St NE;Grand Rapids;;12345;USA

adr1 = vobject.vcard.Address()
adr2 = ...

vadr1 = card.add('adr')
vadr1.value = adr1
vadr1.type_param = "OTHER"

vadr2 = card.add('adr')
vadr2.value = adr2
vadr2.type_param = "WORK"

Or you can access vadr2 after it's created with:

card.adr_list[1]

Sincerely,
Jeffrey


More information about the VObject mailing list