Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries. Thanks for all your past and future contributions.
Importing business cards (vCard) using Symbian C++
How can I import more than one business cards (vCard) from an RReadStream source to the contacts database using CBCardEngine::ImportBusinessCardL()?
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:
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.