Importing business cards (vCard) using Symbian C++
Article Metadata
Compatibility
S60 2nd Edition
Article
Overview
How can I import more than one business cards (vCard) from an RReadStream source to the contacts database using CBCardEngine::ImportBusinessCardL()?
Description
The ImportBusinessCardL() function reads only one vCard from a source stream into a single contact item 'aDestItem'. When importing a contact item using ImportBusinessCardL(), you don't have to take care of the length of the data stream, in other words, you don't need to detect the end of the stream. If the source stream contains more than one card and you want to import all the vCards to the contacts database, use CContactDatabase::ImportContactsL() and specify the aOption parameter accordingly. If, for some reason, you want to import more than one card using CBCardEngine::ImportBusinessCardL(), follow this workaround solution:
Solution
1. Use CParserVCard to parse the aSourceStream.
2. Call either EntityL(_L("VCARD"),...) or ArrayOfEntities() to get an array of CVersitParser objects.
3. Iterate the array and call ExternalizeL(RWriteStream).
4. Convert the RWriteStream object into an RReadStream object.
5. Call ImportBusinessCardL() with the new aSourceStream.
6. Repeat steps 3-5 to get the next object until all items in the array are done.


(no comments yet)