Remove Search Filters from Email

Removes the email search filters.

Command availability: IBM RPA SaaS and IBM RPA on premises

Description

Removes the search filters from email, applied by the Apply Search Filters (emailApplySearchFilters) command.

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.

emailRemoveSearchFilters --connection(EmailConnection)

Dependencies

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
Connection connection Required Email Connection Variable with the collection containing the email messages to remove the search filter.

Example

The command removes a search filter applied to an email server.

defVar --name emailConnection --type EmailConnection
defVar --name currentMessage --type EmailMessage
defVar --name senderEmail --type List --innertype String --value "[senderemail@gmail.com]"
defVar --name recipientEmail --type List --innertype String --value "[recipientemail@email.com]"
defVar --name filteredEmailSubject --type String
defVar --name filteredEmailBody --type String
defVar --name filteredSenderEmail --type String
defVar --name unfilteredMessage --type EmailMessage
defVar --name unfilteredSubject --type String
defVar --name unfilteredBody --type String
defVar --name unfilteredSender --type String
imapConnect --mailhost "outlook.office365.com" --mailport 993 --usessl--username "useremail@email.com" --mailusername "useremail@email.com" --mailpassword userpassword --enableLogemailConnection=value
// A filter is applied to search only the emails that match the specified filters.
emailApplySearchFilters --searchallemails--from ${senderEmail} --to ${recipientEmail} --subjectdirective "All" --wordsdirective "All" --connection ${emailConnection}
foreach --collection "${emailConnection}" --variable "${currentMessage}"
emailRead --message ${currentMessage} filteredEmailSubject=subject filteredEmailBody=body filteredSenderEmail=from
endFor
// The filter is removed.
emailRemoveSearchFilters --connection ${emailConnection}
foreach --collection "${emailConnection}" --variable "${unfilteredMessage}"
emailRead --message ${unfilteredMessage} unfilteredSubject=subject unfilteredBody=body unfilteredSender=from
endFor
emailDisconnect --connection ${emailConnection}
Note:Use a valid email connection to run this example script.