03-07-2013 12:39 AM
I am having a vcard file(.vcf file) and when i try to parse that vcard using contactFromVCard("asset:///newfile.vcf") method, the returned contact object is always empty.
So i checked Contact::isValid() method to check whether contact is valid or not. It is showing that contact is invalid and not able to get any contact information from that object.
I tried to parse vcard with different versions (2.1 and 3.0) but i am always getting contact as a invalid.
Evenif I tried to generate vcard using contactToVCard(c.id()) method and parse that generated vcard using above method, i am getting contact as a invalid.
Format of vcard is as follow which i am using for parsing :
BEGIN:VCARD VERSION:3.0 PRODID:-//Research In Motion//RIM App//EN UID:6 FN:Test Trst N:Trst;Test;;; TEL;TYPE=CELL:9999999999 END:VCARD
What should be the problem??
Solved! Go to Solution.
03-07-2013 01:01 AM - edited 03-07-2013 01:06 AM
contactFromVCard method takes vCardData as argument not file path of the vcf. Use QFile to read file data pass it as method argument.
QFile file("filepath"); file.open(QIODevice::ReadWrite); Contact c = ContactService().contactFromVCard(file.readAll()); file.close();