Discussion Board

Results 1 to 4 of 4
  1. #1
    Registered User
    Join Date
    Jun 2009

    changing contact values in phonebook

    Hi together,

    I would like to change the stored values of a contact. That means if a contact has a firstname I would like to change the value of this entry via a py-script.

    I read the pyS60 reference and found that there is a class named ContactField with a attribute value but I didn't get the right syntax for using it.

    can anyone help me with this issue?

    Many thanks,

  2. #2
    Super Contributor
    Join Date
    Oct 2007
    Deva, Romania

    Re: changing contact values in phonebook


    If I understood your requirement, this is what you need:
    import contacts
    db = contacts.open()
    #Find the contacts that contain the name which you want to change
    #This will return a list of matching contacts; you have to make sure the first name is the one you want, then change it
    for c in db.find('Jim'):
    	if c.find('first_name')[0].value == u"Jim":
    		c.find('first_name')[0].value = u"James"
    Last edited by bogdan.galiceanu; 2009-08-27 at 13:37.

  3. #3
    Regular Contributor
    Join Date
    Sep 2008
    London, UK

    Re: changing contact values in phonebook

    i recommend you read here for field types http://pys60.garage.maemo.org/doc/s60/node83.html and experimenting with Python Shell should help you understand. use the dir(<var>) too.
    There are a few articles in the wiki too

    but here's a specific example
    import contacts
    c=contacts.open() #access contacts db
    Lc=c.find('home') #search entry named 'Home', returns a list 
    contact=Lc[0] #lets assume there's only one result
    contact_no=contact.find('phone_number')[0] #retrieves the phone_number field
    print contact_no.value #display the current number
    now check your phonebook
    PyS60 1.9.7 on E71

  4. #4
    Registered User
    Join Date
    Jun 2009

    Re: changing contact values in phonebook

    thanks a lot! that was exactly what I have searched for!

Similar Threads

  1. deleting single contact from phonebook
    By vikiatNokia in forum Symbian
    Replies: 40
    Last Post: 2009-05-11, 13:35
  2. Updating a contact in Phonebook??
    By gmsk19 in forum Symbian
    Replies: 2
    Last Post: 2009-05-11, 08:00
  3. Replies: 3
    Last Post: 2009-02-23, 17:04
  4. Enumarating contact list
    By shagishkumar in forum Mobile Java General
    Replies: 3
    Last Post: 2006-06-27, 05:34
  5. Changing and Obtaining Item values of the Setting list
    By leonidf in forum Symbian User Interface
    Replies: 0
    Last Post: 2002-07-18, 04:10

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts