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. Thanks for all your past and future contributions.

Listing inbox messages in Symbian Web Runtime

From Wiki
Jump to: navigation, search

This code snippet shows how to get a list of received messages in Symbian Web Runtime, using the Messaging Platform Service (introduced in S60 5th Edition).

Article Metadata
Code ExampleTested with
Devices(s): Nokia 5800 XpressMusic
Platform(s): S60 5th Edition
S60 5th Edition
Keywords: device.getServiceObject(), Service.Messaging.GetList()
Created: ivruban (10 Dec 2008)
Last edited: hamishwillee (05 Oct 2012)



The device.getServiceObject("Service.Messaging", "IMessaging") method is used to obtain access to the service object for the Messaging Service API.

After setting the correct values for the criteria object (criteria.Type, criteria.Filter, and criteria.Filter.MessageTypeList), the IMessaging.GetList(criteria) method is used for getting the list of messages synchronously.

Source: Relevant HTML components

<input type="radio" name="choiceType" id="sms" checked="true" />
<label for="sms">SMS</label><br />
<input type="radio" name="choiceType" id="mms" />
<label for="mms">MMS</label><br />
<input type="button" value="Get messages"
onclick="getMessageList();" />
<select size="5" id="messageList" multiple></select><br />

Source: JavaScript file

var serviceObj = null;
window.onload = init;
// Initializes the widget
function init() {
try {
serviceObj = device.getServiceObject("Service.Messaging",
} catch (ex) {
alert("Service object cannot be found.");
// Get the list of all messages and show it in SELECT object.
function getMessageList() {
var criteria = new Object();
criteria.Type = "Inbox";
criteria.Filter = new Object();
criteria.Filter.MessageTypeList = new Array();
if (document.getElementById("sms").checked) {
criteria.Filter.MessageTypeList[0] = "SMS";
} else {
criteria.Filter.MessageTypeList[0] = "MMS";
try {
// Get list of messages
var result = serviceObj.IMessaging.GetList(criteria);
if(result.ErrorCode != 0) {
alert("Error in getting messages");
} catch(exception) {
alert("getList: " + exception);
// Displays available messages in a list box
function showMessages(iterator) {
var messageList = document.getElementById("messageList");
//Iterator is the list of the files, reset to set pointer to the first
//Cleaning the file list.
while (messageList.length != 0) {
document.getElementById("messageList").style.display = "block";
var item;
while ((item = iterator.getNext()) != undefined) {
var node = document.createElement("option");
//Value of option consists of the full path.
node.value = item.MessageId;
node.appendChild (document.createTextNode(item.Sender + item.Time +


  • After loading, a listbox with all messages from inbox (SMS or MMS) is shown.
  • The user can choose the type of message.
  • Thw list box contains the "From", "Data/Time", and message text fields.

Supplementary material

You can view the source file and executable application in the attached ZIP archive. The archive is available for download at Media:Listing inbox messages in

This page was last modified on 5 October 2012, at 05:58.
49 page views in the last 30 days.