How to modify Contacts Database?

Login to reply to this topic.
Sat, 2003-12-20 14:57
Joined: 2003-12-11
Forum posts: 14
hi all,
I was just wondering whether it is possible to modify existing contacts/addressbook database that Symbian OS uses.
e.g
I want add a new field to store spouse's name or birthdate or any kind of data. Is it possible to add a new field in the existing database which contains default fields like phone number, Address info, etc.

If this is possible then how should i do it? does anyone have any sample code available anywhere or any guidelines which I can follow?

thanks in advance

Mon, 2004-08-02 16:00
Joined: 2004-06-22
Forum posts: 148
How to modify Contacts Database?
i have been struggling with the same for sometime now..if u have been able to find the answers please let me know of the same would be of great help.
ciao
Tue, 2004-08-03 07:19
Joined: 2004-07-29
Forum posts: 11
How to modify Contacts Database?
Well here is the code(which works perfectly) to add a contact to the Contacts Database.



//Storing a contact to the database
 
  // Some literal strings for the fields:
_LIT(KForenameLabel,"Forename");
_LIT(KSurnameLabel,"Surname");
_LIT(KWorkPhoneLabel,"Work Phone");
_LIT(KForename,"Steve");
_LIT(KOtherForename,"Bob");
_LIT(KSurname,"Wilkinson");
_LIT(KWorkPhone,"+441617779700");
// Open the default contacts database:
contactsDb = CContactDatabase::OpenL();
CleanupStack::PushL(contactsDb);
// Create a contact card and add some fields:
CContactItem* contact = CContactCard::NewLC();
CContactItemField* field = CContactItemField::NewLC(KStorageTypeText,
KUidContactFieldFamilyName);
field->SetMapping(KUidContactFieldVCardMapUnusedN);
field->SetLabelL(KSurnameLabel);
field->TextStorage()->SetTextL(KSurname);
contact->AddFieldL(*field);
CleanupStack::Pop();

field = CContactItemField::NewLC(KStorageTypeText, KUidContactFieldGivenName);
field->SetMapping(KUidContactFieldVCardMapUnusedN);
field->SetLabelL(KForenameLabel);
field->TextStorage()->SetTextL(KForename);
contact->AddFieldL(*field);
CleanupStack::Pop();
field = CContactItemField::NewLC(KStorageTypeText, KUidContactFieldPhoneNumber);
field->SetMapping(KUidContactFieldVCardMapTEL);
field->SetLabelL(KWorkPhoneLabel);
field->TextStorage()->SetTextL(KWorkPhone);
contact->AddFieldL(*field);
CleanupStack::Pop();
// Add the new contact to the database and set it as the own card:
contactsDb->AddNewContactL(*contact);
contactsDb->SetOwnCardL(*contact);
CleanupStack::PopAndDestroy(2); // contact contactsDb
 

                              Regards
                               ---Rajesh Cheezy hands0me_20@yahoo.com

Work is the greatest thing on the earth.......

Thats why you should always leave some for tomorrow

Mon, 2004-11-22 09:55
Joined: 2004-10-27
Forum posts: 169
How to modify Contacts Database?
hi,
I used this code by when I want to Dial wiliam's number
my 3650 will be restart???
Wed, 2006-05-31 14:02
Joined: 2006-05-22
Forum posts: 36
Re: How to modify Contacts Database?

Hello ,

I took u r code for Storing a contact to the database which u r writting here but there is problem  for SetTextL.
It gives error "left of '->SetTextL' must point to class/struct/union ". and "use of undefined type 'CContactTextField'"

What should i do? Reply for this.
Wed, 2006-05-31 14:27
Joined: 2006-05-22
Forum posts: 37
Re: How to modify Contacts Database?
Try to replace

field->TextStorage()->SetTextL(KSurname);

with

field->TextStorage().SetTextL(KSurname);

have fun...

Rayko Enz
www.sic-software.com

Thu, 2006-06-01 06:36
Joined: 2006-05-22
Forum posts: 36
Re: How to modify Contacts Database?
Hi again,

I tried u r solution but again it doesn't work.gives same error "left of '.SetTextL' must have class/struct/union type".

Actually I want to add contacts into default  fields of contact database.

(Is there any code for adding contacts from .txt  file to contactDB.I used seperator ",".
If U have such a type of code pls. reply me.)

& thanx for reply.



Thu, 2007-05-17 08:18
Joined: 2007-01-12
Forum posts: 51
Re: How to modify Contacts Database?
Quote from: pratibha
Hi again,
 
I tried u r solution but again it doesn't work.gives same error "left of '.SetTextL' must have class/struct/union type".

Actually I want to add contacts into default  fields of contact database.

 (Is there any code for adding contacts from .txt  file to contactDB.I used seperator ",".
If U have such a type of code pls. reply me.)

& thanx for reply.

most probably ur first try was ok...only thing i think u forgot to include CNTFLDST.H
  • Login to reply to this topic.