SortCriteria Property
Sorts criteria to use for message retrieval operations.
Syntax
imap.getSortCriteria([callback]) imap.setSortCriteria( sortCriteria, [callback])
Default Value
""
Callback
The 'callback' parameter specifies a function which will be called when the operation completes (or an error is encountered). If the 'callback' parameter is not specified, then the method will block and will not return until the operation completes (or an error is encountered).
The callback for the getSortCriteria([callback]) method is defined as:
function(err, data){ }
'err' is the error that occurred. If there was no error, then 'err' is 'null'.
'data' is the value returned by the method.
The callback for the setSortCriteria([callback]) method is defined as:
function(err){ }
'err' is the error that occurred. If there was no error, then 'err' is 'null'.
'err' has 2 properties which hold detailed information:
err.code err.message
Remarks
This property sorts criteria to use for message retrieval operations. When set, the class will send the SORT command to the server before any retrieval. If the server supports the SORT command, the results from the fetch operation will be sorted according to SortCriteria. The format of the SortCriteria property consists of a parenthesized list of one or more sort keys.
Example (Setting SortCriteria)
IMAPControl.SortCriteria = "DATE" IMAPControl.SortCriteria = "SUBJECT FROM" IMAPControl.SortCriteria = "REVERSE SUBJECT"
Possible sort keys include:
ARRIVAL | Internal date and time of the message. |
DATE | The value of the message's DATE header, adjusted by time zone |
CC | The value of the message's CC header. |
FROM | The value of the message's FROM header. |
SUBJECT | The value of the message's SUBJECT header. |
TO | The value of the message's TO header. |
SIZE | The size of the message |
REVERSE <criterion> | Followed by another sort criterion, has the effect of that criterion but in reverse (descending) order |
Please note that IMAP SORT functionality is relatively new and not all servers may implement it.
Data Type
String