Re: [Evolution-hackers] Adding an email address to an EContact



On Mon, 2005-05-02 at 15:54 -0500, Hans Petter Jansson wrote:
> You should add the address with
> 
> e_vcard_attribute_add_value (attr, "tom foo bar");

Great, thanks!

> Also remember that you have to commit the contact for it to be stored
> back in the address book.

Argh!  I completely overlooked e_book_commit_contact... works great now,
thanks much!

For posterity, here's a snippet which adds an email address to a
contact.  It assumes you've got an open EBook and an existing EContact
assigned to 'contact':

================================
EVCardAttribute* attr = e_vcard_attribute_new(NULL, EVC_EMAIL);
e_vcard_attribute_add_value(attr, "tom foo bar");
GList* email_attrs = g_list_append(NULL, attr);
e_contact_set_attributes (contact, E_CONTACT_EMAIL, email_attrs);
GError* error = NULL;
e_book_commit_contact(book, contact, &error)
================================

Thanks again!

Yours,

Tom





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]