6.8.5 ChangeStatus

ChangeStatus method changes the read status of a message. The status can be Read, Unread, Replied, or Forwarded. It is available only in synchronous mode.

The following is an example for using ChangeStatus:

Synchronous

messaging_handle.call('ChangeStatus', {'MessageId': message_id, 'Status': u'Unread'})

The following table summarizes the specification of ChangeStatus:

Interface IMessaging
Description Sets a given value for the given flag.
Response Model Synchronous
Pre-condition Valid instance of IMessaging interface is instantiated.
Post-condition Message status changed to new status.

Input Parameters

Input parameter specifies the message ID, and message status to be set.

Table 6.178: Input parameters for ChangeStatus
Name Type Range Description
MessageId 32 bit int NA Message Id
Status unicode string Read
Unread
Replied
Forwarded
Message status to be set. Replied and Forwarded are applicable for email type of messages.


Output Parameters

Output parameters contain ErrorCode, and ErrorMessage if the operation fails.

Table 6.179: Output parameters for ChangeStatus
Name Type Range (Type: string) Description
ErrorCode int NA Service specific error code on failure of the operation.
ErrorMessage string NA Error description in Engineering English.


Errors

The following table lists the error codes and their values:

Table 6.180: Error codes
Error code value Description
0 Success
1000 Invalid service argument
1002 Bad argument type
1003 Missing argument
1012 Item Not found


Error Messages

The following table lists the error messages and their description:


Table 6.181: Error messages
Error messages Description
Messaging:ChangeStatus:MessageId Type Invalid Specifies if the type of MessageId parameter is invalid.
Messaging:ChangeStatus:MessageId Value Incorrect Specifies if the value of MessageId parameter is incorrect.
Messaging:ChangeStatus:MessageId Missing Specifies if the MessageId parameter is missing.
Messaging:ChangeStatus:Status Type Invalid Specifies if the type of Status parameter is incorrect.
Messaging:ChangeStatus:Status Value Incorrect Specifies if the range of Status parameter is exceeded.
Messaging:ChangeStatus:Status Missing Specifies if the Status parameter is missing.
Messaging:ChangeStatus:Asynchronous Operation not supported Specifies if ChangeStatus is called asynchronously.


Example

The following sample code illustrates how to set SMS status as Unread:

import scriptext
import appuifw

messaging_handle = scriptext.load('Service.Messaging', 'IMessaging')

sms_iter = messaging_handle.call('GetList', {'Type': u'Inbox'})
id_list = []
body_list = []
for sms_dict in sms_iter:
    if sms_dict['MessageType'] == 'SMS': 
        id_list.append(sms_dict['MessageId'])
        body_list.append(sms_dict['BodyText'])

message_index = appuifw.selection_list(body_list)
try:
    messaging_handle.call('ChangeStatus', {'MessageId': id_list[message_index],
                                           'Status': u'Unread'})
except scriptext.ScriptextError, err:
    print "Error setting message status to Unread"
else:
    print "Message status changed to Unread"

See About this document... for information on suggesting changes.