GetList is used to retrieve a list of messaging objects from messaging center based on the search / sort inputs. Each object contains messaging information that is, data and metadata about a single message. It is available only in synchronous mode.
The following is an example for using GetList:
sms_iter = messaging_handle.call('GetList', {'Type': u'Inbox'})
The following table summarizes the specification of GetList:
| Interface | IMessaging |
| Description | Retrieves an iterable message list based on the search / sort inputs. |
| Response Model | Synchronous |
| Pre-condition | Valid instance of IMessaging interface is instantiated. |
| Post-condition | Nil |
Input Parameters
Input parameter specifies the folder from which the messages are retrieved, also the Filter criteria and sort order for the returned list. Input parameter has three properties: Type, Filter and SortOrder.
|
Output Parameters
Output parameters contain the requested information. They also contain ErrorCode, and ErrorMessage if the operation fails.
|
Errors
The following table lists the error codes and their values:
|
Error Messages
The following table lists the error messages and their description:
|
Example
The following sample code illustrates how to iterate through inbox and print the SMS 'Sender' IDs:
import scriptext
messaging_handle = scriptext.load('Service.Messaging', 'IMessaging')
# This 'GetList' request returns all the SMS in the inbox as an iterable map
sms_iter = messaging_handle.call('GetList', {'Type': u'Inbox'})
sender_list = []
for sms_dict in sms_iter:
if sms_dict['MessageType'] == 'SMS':
sender_list.append(sms_dict['Sender'])
print "ID list :", sender_list
See About this document... for information on suggesting changes.