Apply Classification Filters
Applies filters to classify messages from an email server.
Command availability: IBM RPA SaaS and IBM RPA on premises
Description
Applies filters to classify messages from an email server.
Script syntax
IBM RPA's proprietary script language has a syntax similar to other programming languages. The script syntax defines the command's syntax in the script file. You can work with this syntax in IBM RPA Studio's Script mode.
emailApplyClassificationFilters [--dateordering(EmailOrdering)] [--fromordering(EmailOrdering)] [--toordering(EmailOrdering)] [--subjectordering(EmailOrdering)] [--sizeordering(EmailOrdering)] [--limit(Numeric)] [--offset(Numeric)] --connection(EmailConnection)
Dependencies
-
Use the For Each (
forEach) command to get email message instances. Otherwise, the command will only return the first result. -
Use the following commands to connect to an email server:
-
Connect to Exchange Email Server (
exchangeConnect) -
Connect to IMAP Email Server (
imapConnect) -
Connect to Outlook Server (
outlookConnect)
-
Input parameters
The following table displays the list of input parameters available in this command. In the table, you can see the parameter name when working in IBM RPA Studio's Script mode and its Designer mode equivalent label.
| Designer mode label | Script mode name | Required | Accepted variable types | Description |
|---|---|---|---|---|
| Date Ordering | dateordering |
Optional |
EmailOrdering |
Option for sorting email by date. See the dateordering parameter options for the available options. |
| From Ordering | fromordering |
Optional |
EmailOrdering |
Option for sorting emails by sender. See the fromordering parameter options for the available options. |
| To Ordering | toordering |
Optional |
EmailOrdering |
Option for sorting emails by recipient's name. See the toordering parameter options for the available options. |
| Subject Ordering | subjectordering |
Optional |
EmailOrdering |
Option for sorting emails by subject. See the subjectordering parameter options for the available options. |
| Size Ordering | sizeordering |
Optional |
EmailOrdering |
Option for sorting emails by size. See the sizeordering parameter options for the available options. |
| Limit | limit |
Optional |
Number |
Maximum amount of messages to be returned from the mail server in the rank. |
| Offset | offset |
Optional |
Number |
Number of offset to the starting position of the mailing list returned by the server in the sort. |
| Connection | connection |
Required |
Email Connection |
Variable with the collection containing the email messages to apply the classification filter. |
dateordering parameter options
The following table displays the options available for the dateordering input parameter. The table shows the options available when working in Script mode and the equivalent label in the Designer mode.
| Designer mode label | Script mode name |
|---|---|
| Ascending | Ascending |
| Descending | Descending |
| None | None |
fromordering parameter options
The following table displays the options available for the fromordering input parameter. The table shows the options available when working in Script mode and the equivalent label in the Designer mode.
| Designer mode label | Script mode name |
|---|---|
| Ascending | Ascending |
| Descending | Descending |
| None | None |
toordering parameter options
The following table displays the options available for the toordering input parameter. The table shows the options available when working in Script mode and the equivalent label in the Designer mode.
| Designer mode label | Script mode name |
|---|---|
| Ascending | Ascending |
| Descending | Descending |
| None | None |
subjectordering parameter options
The following table displays the options available for the subjectordering input parameter. The table shows the options available when working in Script mode and the equivalent label in the Designer mode.
| Designer mode label | Script mode name |
|---|---|
| Ascending | Ascending |
| Descending | Descending |
| None | None |
sizeordering parameter options
The following table displays the options available for the sizeordering input parameter. The table shows the options available when working in Script mode and the equivalent label in the Designer mode.
| Designer mode label | Script mode name |
|---|---|
| Ascending | Ascending |
| Descending | Descending |
| None | None |
Example
This command sorts messages from an email server by selecting sorting options for the fields that need to be highlighted in the desired order.
defVar --name emailConnection --type EmailConnection
defVar --name filteredMessage --type EmailMessage
// Connect to the outlook365 imap server.
imapConnect --mailhost "outlook.office365.com" --mailport 993 --usessl --username "useremail@email.com" --mailusername "useremail@email.com" --mailpassword userpassword --enableLogemailConnection=value
foreach --collection "${emailConnection}" --variable "${filteredMessage}"
emailApplyClassificationFilters --dateordering "Ascending" --fromordering "Ascending" --toordering "Ascending" --subjectordering "Descending" --sizeordering "Ascending" --limit 25 --offset 1 --connection ${emailConnection}
endFor
// Sorts all messages with the entered filters, sorting Ascending or Descending of messages.
emailDisconnect --connection ${emailConnection}
Note: Use a valid email connection to run this example script.