Executes one or more activities for each email in an Outlook folder or in a selection of messages. This activity must be added inside a Use Outlook Account activity.
Use this activity when you are working with multiple messages and you want to repeat one or more activities for each individual message. You can indicate an Outlook folder whose emails to iterate through, or iterate through the folder or the emails that are selected in Outlook when the project is executed. Add the activities to repeat inside For Each Email and, when you configure the activities, select CurrentMail from the Plus menu to indicate that you want to repeat the actions for each message in the iteration. For some activities, you must select a specific message field to use from each email: Subject, Body (message body in plain text), Bcc, Cc, To, From (sender and recipient fields return a list of email addresses separated by semicolon), or Priority (High, Low, Normal).
To learn how to use this activity, see:
- Tutorial: Iterating through Outlook Mails and Saving Attachments.
- Tutorial: Saving, Renaming, and Moving Attachments.
- For each - Enter the name by which to refer to the current email in the iteration. Using a name that describes the type of email makes it easier to identify and select the current email option when configuring activities added inside For Each Email. For example, for a selection of emails that contain invoices, you can enter
Invoice. The default value is
- In emails from - Click Plus on the right side of the field and then, from the menu, select the Outlook folder that contains the mail messages you want to use, or choose Selected Mails or Selected Folder to use the messages or the folder selected in Outlook when the project is executed. Alternatively, you can select Open in Advanced Editor and enter a VB expression.
- Limit emails to first - Enter or select a limit for the maximum number of emails to process. Set a lower limit if you want to reduce processing times. The default value is 100 emails.
- Unread mail - Select this option if you want to process only unread emails. This option is not selected by default.
- Additional filters - Click this button to configure an advanced filter for the emails to process.
In the Filter window:
- From the first drop-down menu, select an email field to filter by: Bcc, Cc, Date, From, To.
- From the second drop-down menu, select an operator to evaluate the email field:
- For the fields Bcc, Cc, From, and To: contains, ends with, starts with, or equals.
- for the Date field: older than or newer than the time period indicated in the third drop-down menu: 1, 2, 3, 7, 14, 30, or 90 days.
- Click Plus on the right side of the third field, and then use one of the options in the menu to indicate the value against which to evaluate the selected email field:
- Data from the Project Notebook, a parent Excel file or Outlook account. For example, indicate a field in the email that is selected in Outlook when the project is executed.
- Use Saved Value - Use data that you previously saved for later use in the project.
- Text - Enter text in the Text Builder.
- Ask when run - Prompt for a value when the project is executed.
- Open in Advanced Editor - Enter a VB expression.
- Click Add if you want to add other conditions, and select if All or Any of the conditions should be used to filter.
- DisplayName - The name displayed for the activity in the Designer panel.
- Private - If selected, the data used in the activity is not logged by StudioX.
- See the options in the body of the activity.
The activity only processes emails stored locally in the Outlook data file. For information on what to do if some of your emails are not processed, see Outlook Troubleshooting in the StudioX Guide.
Updated 8 months ago