×
Namespaces

Variants
Actions

Archived:How to handle contacts in m

From Nokia Developer Wiki
Jump to: navigation, search

Archived.pngArchived: This article is archived because it is not considered relevant for third-party developers creating commercial solutions today. If you think this article is still relevant, let us know by adding the template {{ReviewForRemovalFromArchive|user=~~~~|write your reason here}}.

M on Symbian is not maintained and may not run on current Symbian versions. All M articles have been archived.

Article Metadata
Tested with
Devices(s): Nokia N95, Nokia E90
Compatibility
Platform(s): S60 2nd Edition, S60 3rd Edition, S60 5th Edition
Symbian
S60 5th Edition
Platform Security
Capabilities: )
Article
Created: bogdan.galiceanu (22 May 2009)
Last edited: hamishwillee (09 May 2013)

Contents

Overview

This article shows how to add, find and delete contacts in m.

Preconditions

Note: The add and delete functions require the WriteApp permission. The find and get functions require the ReadApp permission.

Source code

Adding a contact

use contacts
 
 
//Create a contact as an array of key-value pairs
my_contact = ["name":"Doe", "fname":"John", "phone":"1234567890", "email":"john.doe@company.com"]
 
//Add it to the database
contacts.add(my_contact)

Finding contacts

use contacts
 
 
//Get the ids of the contacts that match the criteria
ids = contacts.find("John Doe", ["fname", "name"])
 
//Get the corresponding contact objects and display all their information
for id in ids do
my_contact = contacts.get(id);
for i in keys(my_contact) do
print contacts.labels()[i] + ": " + my_contact[i]
end;
end

Deleting contacts

use contacts
 
 
//Get the ids of the contacts that match the criteria
ids = contacts.find("John Doe", ["fname", "name"])
 
//Delete them all
for id in ids do
contacts.delete(id)
end

Postconditions

Contacts are added, found or deleted.

Additional information

Details about the functions used in the snippets above and others are available in the m library.

This page was last modified on 9 May 2013, at 05:44.
39 page views in the last 30 days.
×