In this tutorial, we will create an automation that saves the attachments to all the emails in an Outlook Search Folder to your computer.
We will create a project and start by adding an Outlook Account Card to indicate the Outlook account to use. In the card, we will add the activities to automate inside a For Each Mail Message activity to indicate that the activities should be repeated for every email as we iterate through them..
Step 1: Create a Temp folder on your computer and a Search Folder in Outlook.
- Create a folder named Temp at the root of the C: drive on your computer.
- Open Outlook, then right-click Search Folders in the Folder pane and select New Search Folder.
- In the New Search folder window, select Create a custom Search Folder > Choose.
- In the Custom Search Folder window, enter "Last week's attachments" in the Name box and then select Criteria.
- In the Messages tab of the Search Folder Criteria window, from the drop-down menus next to Time select received and Last Week.
- From the More Choices tab, select Only items with and then one or more attachments from the adjacent drop-down menu.
- Click OK three times to close the windows and save the search folder.
Step 2: Set up the project.
Step 3: Add the Outlook account to the project.
- In the Activities panel, select the Outlook tab and then double-click Outlook Account Card. An Outlook Account Card activity is added to the Designer panel.
- In the activity, the default email account is already selected in the Select mail account field. If you want to use a different account, select it from the drop-down menu.
In the And reference it later as field, enterMyOutlook
as the name under which to refer to the account in the automation.
Step 4: Iterate through the messages in the Outlook folder.
- In the Activities panel, drag the For Each Mail Message activity and drop it inside the Outlook Account Card.
- In the For Each Mail Message activity, click on the right side of the Use mails from field, and then select MyOutlook > [Search Folders] > [Last week's attachments] to select the search folder created in the account
MyOutlook
. Your selection is displayed in the Use mails from field asMyOutlook.SearchFolder("Last%20week%27s%20attachments")
.
You have indicated that you want to iterate through the emails in the Outlook Search Folder Last week's attachments.
Step 5: Save the attachments for each message to a folder on your computer.
- In the Activities panel, drag the Save Mail Attachments activity and drop it inside the For Each Mail Message activity.
- In the Save Mail Attachments activity:
- Click on the right side of the From message field, and then select Current Mail to indicate that the email whose attachments you want to save is the current email you are iterating through.
- Click next to the Save to folder field, and then browse to and select the folder on your computer where to save the attachments. For this example, we created a folder called
Temp
on the C drive of the computer.
- Click Save in the ribbon menu to save the automation, then click Run to execute the automation.
The attachments from each each email in the Outlook folder Temp are saved to the Temp folder on the computer.
Updated 2 years ago