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.

Removing message from Inbox in Symbian Web Runtime

From Wiki
Jump to: navigation, search
Article Metadata
Code ExampleTested with
Devices(s): Nokia 5800 XpressMusic
Platform(s): S60 5th Edition
S60 5th Edition
Keywords: device.getServiceObject(), Service.Messaging.Delete()
Created: dekuykin (10 Dec 2008)
Last edited: hamishwillee (01 Aug 2012)



This code snippet shows how to delete a message from the Inbox using the Messaging Platform Service for S60 Web Runtime introduced in S60 5th Edition.

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


The HTML select component contains the messages:

<select size="5" id="messageList" multiple></select><br />
var serviceObj = null;
// Initializes the widget
function init() {
try {
serviceObj = device.getServiceObject("Service.Messaging",
} catch (ex) {
alert("Service object cannot be found.");
// Removes the message which is selected in the list box.
function removeMessage() {
// Get a reference to SELECT object which contains the list of messages
var messageList = document.getElementById("messageList");
var criteria = new Object();
// Find the selected messages
for (var msgIndex = 0; msgIndex < messageList.length; msgIndex++) {
if (messageList.options[msgIndex].selected) {
// Get message id of the selected message
var messageId = messageList.options[msgIndex].value;
// Radix of message id integer value
var radix = 10;
// Get numeric representation of the message id
criteria.MessageId = parseInt(messageId, radix);
// Delete the message
var result = serviceObject.IMessaging.Delete(criteria);
if (result.ErrorCode !== 0) {
alert("Error in deleting messages");
// Remove message record from selection list
msgIndex = msgIndex - 1;


The selected SMS or MMS messages are deleted.

Supplementary material

You can view the source file and executable application in the attached ZIP archive. The archive is available for download at Media:Removing message from Inbox in

See also

This page was last modified on 1 August 2012, at 04:40.
56 page views in the last 30 days.