6.8.1 GetList

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.

Table 6.162: Input parameters for Getlist
Name Type Range Description
Type unicode string Inbox Performs operation based on the specified content types.
[Filter] map
[MessageTypeList]: List of unicode strings
[MessageId]: 32 bit int
[SenderList]: List of unicode strings
[Subject]: unicode string
[StartDate]: Date
[EndDate]: Date
MessageTypeList:
SMS
MMS
It specifies the search information.

If StartDate alone is specified, all messaging from the data will be returned and if EndDate alone is specified, all messages before the end date will be returned. And if both are specified then all the messages within the two bounds will be returned. An exception will be raised if EndDate is earlier than StartDate.

[SortOrder] map
Key: unicode string
Order: unicode string
Key:
Date
Size
Sender
Subject
MessageId

Order:
Ascending
Descending

Sort Information. If not specified sorting is done on Date in ascending order.


Output Parameters

Output parameters contain the requested information. They also contain ErrorCode, and ErrorMessage if the operation fails.

Table 6.163: Output parameters for GetList
Name Type Range (Type: string) Description
ReturnValue Iterable List (of maps)
map:
MessageType: string
Sender: string
Subject: string
Time: Time
Priority: string
Attachment: bool
Unread: bool
MessageId: 32 bit int
BodyText: string
To: List of strings
Cc: List of strings
Bcc: List of strings
AttachmentList: List of map

AttachmentList contains a list of Map (Attachment):
AttachmentMap:
FileName: string
FileHandle: FileBuffer
MimeType: string
FileSize: int

MessageTypeList:
SMS
MMS
Unknown

Priority:
Low
Medium
High

An iterable list of the resultant messages. Current implementation recognizes only SMS and MMS, other types of messages are unknown. SMS does not support subject, so it returns first few characters of the body text.

Priority is applicable for Email type of messages. For SMS and MMS, it gives default value set by underlying messaging server.

Note:
Cc and Bcc fields are not applicable for SMS. Also, in case MMS has body text in it ; it appears as attachment. So the output value for body text field in case of MMS will be empty.

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.164: Error codes
Error code value Description
0 Success
1000 Invalid service argument
1002 Bad argument type
1003 Missing argument
1004 Service not supported
1007 No memory


Error Messages

The following table lists the error messages and their description:


Table 6.165: Error messages
Error messages Description
Messaging:GetList: Type Type Invalid Specifies if the type of Type parameter is invalid.
Messaging:GetList:Type Value Incorrect Specifies if the value of MessageType parameter is incorrect.
Messaging:GetList:Type Missing Specifies if the MessageType parameter is missing.
Messaging:GetList:Filter Type Invalid Specifies if the type of Filter parameter is invalid.
Messaging:GetList:SenderList Type Invalid Specifies if the type of SenderList parameter is invalid.
Messaging:GetList:SenderList Element Value Incorrect Specifies if the value of element of SenderList parameter is incorrect.
Messaging:GetList:SenderList Element Type Invalid Specifies if the type of element of SenderList parameter is invalid.
Messaging:GetList:MessageTypeList Type Invalid Specifies if the type of MessageTypeList parameter is invalid.
Messaging:GetList:MessageTypeList Element Value Incorrect Specifies if the value of element of MessageTypeList parameter is incorrect.
Messaging:GetList:MessageTypeList Element Type Invalid Specifies if the type of element of MessageTypeList parameter is invalid.
Messaging:GetList:MessageId Type Invalid Specifies if the type of MessageId parameter is invalid.
Messaging:GetList:Subject Type Invalid Specifies if the type of Subject parameter is invalid.
Messaging:GetList:StartDate Type Invalid Specifies if the type of StartDate parameter is invalid.
Messaging:GetList:StartDate Value Incorrect Specifies if the value of StartDate parameter is incorrect.
Messaging:GetList:EndDate Type Invalid Specifies if the type of EndDate parameter is invalid.
Messaging:GetList:EndDate Value Incorrect Specifies if the value of EndDate parameter is incorrect.
Messaging:GetList:SortOrder Type Invalid Specifies if the type of SortOrder parameter is invalid.
Messaging:GetList:SortOrder Value Incorrect Specifies if the value of SortOrder parameter is incorrect.
Messaging:GetList:Key Type Invalid Specifies if the type of Key parameter is invalid.
Messaging:GetList:Order Type Invalid Specifies if the type of Order parameter is invalid.
Messaging:GetList:Asynchronous Operation not supported Specifies if GetList is called asynchronously.


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.