On Mon, 2005-05-02 at 14:23 -0400, Tom Copeland wrote:
> Howdy -
> 
> I'm trying to write some C that adds an email address to an existing
> EContact; here's what I've got:
> 
> EContact* ev_contact = E_CONTACT(get_contact());
> EVCardAttribute* attr = e_vcard_attribute_new (NULL, EVC_EMAIL);
> e_vcard_attribute_add_param_with_value (attr, e_vcard_attribute_param_new 
> (EVC_TYPE), "WORK");
> e_vcard_attribute_add_param_with_value (attr, e_vcard_attribute_param_new 
> (EVC_X_DEST_EMAIL), "[EMAIL PROTECTED]");
> GList* email_attrs = g_list_append(NULL, attr);
> e_contact_set_attributes (ev_contact, E_CONTACT_EMAIL, email_attrs)
> 
> That doesn't seem to do the trick, though... I must be doing something
> wrong.  I've looked around the source code for a bit but I only seem to
> be able to find examples of importing via the VCard format.  

You should add the address with

e_vcard_attribute_add_value (attr, "[EMAIL PROTECTED]");

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

If you need code to look at, I think the best place to look would be in
Evolution proper:

evolution/addressbook/gui/contact-editor/e-contact-editor.c

-- 
Hans Petter Jansson | <[EMAIL PROTECTED]>
Evolution Developer | http://hp.cl.no/

_______________________________________________
evolution-hackers maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/evolution-hackers

Reply via email to