Store VCard string as Contact

Store VCard string as Contact

BY 07 Dec 2015 Native Application Development

Dear Tizen Geeks,

Hello.

I need to parse a vcard string to store in the Contact db as contact.

There is a native API for VCARD parsing.

I have implemented my code:

    const char *msg = "BEGIN:VCARD\nVERSION:3.0\nN;CHARSET=UTF-8:Hyman;Jeffrey;;;\nFN;CHARSET=UTF-8:Jeffrey Hyman\nTEL;TYPE=VOICE;PREF;CHARSET=UTF-8:123456789\nEMAIL;TYPE=WORK;PREF;CHARSET=UTF-8:user1@domain.com\nNICKNAME;CHARSET=UTF-8:joey ramone\nREV:2015-02-09T07:08:58Z\nEND:VCARD";
	INF("VCard : [%s]", msg);
	contacts_list_h list = NULL;
	contacts_error_e err = CONTACTS_ERROR_NONE;

err = contacts_connect();
	if(err != CONTACTS_ERROR_NONE)
		ERR("contacts_connect Error[ %s ]", get_error_msg_contact(err));
	err = contacts_vcard_parse_to_contacts(msg, &list);
	if( err != CONTACTS_ERROR_NONE)
		ERR("Error[ %s ]", get_error_msg_contact(err));

	contacts_list_destroy(list, true);

	err = contacts_disconnect();
	if(err != CONTACTS_ERROR_NONE)
		ERR("contact_disconnect() is failed(%x)", err);

 

The problem is, if I send different version’s (except version 3.0) VCard string to contacts_vcard_parse_to_contacts API, the API can’t parse it.

Any idea about this?

Your support is appreciated!

Thanks-

//Mohammad N. Nobi

Written by