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 over the next few weeks. Thanks for all your past and future contributions.

How can I programmatically add contact information with subfields such as "Street (home) on Symbian?

From Wiki
Jump to: navigation, search

Article Metadata
Platform(s): S60 1st Edition
S60 2nd Edition and FP1, FP2, and FP3
S60 3rd Edition
S60 3rd Edition (initial release)
S60 2nd Edition (initial release)
S60 1st Edition
Created: User:Technical writer 2 (24 Aug 2006)
Last edited: hamishwillee (14 Jun 2012)


How can I programmatically add contact information with subfields such as "Street (home)"?


My application manages the contact fields by using the vCard UIDs of the respective fields (TFieldType in cntdef.h). Everything works fine, except for the field "Street (home)", which once added, appears to be in the field "Address (home)".
Unlike normal fields, "Street (home)" is a subfield of "Address (home)". This needs two levels of vCard mapping for adding the information to the correct field.
Below is a simplified code example for doing this:
CContactDatabase* contactsDb = CContactDatabase::OpenL();
CContactItem* contact = CContactCard::NewLC();
CContactItemFieldSet* fieldset = CContactItemFieldSet::NewLC();
CContactItemField* field =
                           KUidContactFieldAddress);     // VCardUID for address field
field->SetMapping(KUidContactFieldVCardMapADR);              // VCardUID for street field type
field->AddFieldTypeL(KUidContactFieldVCardMapHOME);  // VCardUID for home field type
CleanupStack::Pop(2);   // field, fieldset
CleanupStack::PopAndDestroy(2);    // contact, contactsDb

This page was last modified on 14 June 2012, at 06:35.
17 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.


Thank you!

We appreciate your feedback.