| ID | Creation date | May 22, 2009 | |
| Platform | S60 2nd Edition, S60 3rd Edition, S60 5th Edition | Tested on devices | Nokia N95, Nokia E90 |
| Category | M | Subcategory | PIM |
| Keywords (APIs, classes, methods, functions): contacts |
This article shows how to add, find and delete contacts in m.
Note: The add and delete functions require the WriteApp permission. The find and get functions require the ReadApp permission.
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)
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
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
Contacts are added, found or deleted.
Details about the functions used in the snippets above and others are available in the m library.
No related wiki articles found