Objective
The objective of this practice problem is for the user to demonstrate an understanding of the Outlook commands discussed in the previous sections by creating an automation that utilizes said commands. The commands covered in the previous section were the Send Outlook Email & Move/Copy Outlook Emails In the future, these commands may be implemented into other practice problems.
Scenario
An employee of the ABC company is in the process of sending themselves an email and moving said email into another folder. This employee is conducting the exercise to test the functionality of moving emails in Outlook folders.
Prerequisites
The user will ensure that the following two folders exist in their Outlook email: Inbox and Test. Please note that the Test folder must not be a sub-folder to another Outlook folder or else the automation solution will not work.
Practice Problem Requirements
The user must create an automation that performs the following tasks:
  • Sends a test email to themselves (example@test.com)
  • Pauses the scripts for 15,000 milliseconds (15 seconds) to wait for email to enter Inbox
  • Moves the unread test email into the Test folder

Problem Difficulty: Intermediate
Solution will be provided on the next page with a brief explanation.

Solution
The code for the solution has been provided below.
As a quick summary:

Step 1: The Send Outlook Email command must be called first to draft and send the email. Ensure that the email is being sent to the user’s email address (i.e. example@test.com)

Step 2: The Pause Script command is used in this exercise in order to wait for the email to exist in the inbox because OpenBots works faster than Outlook. OpenBots will look for the email before it is in the Inbox folder, will see it’s not there, and then throw an error. To be safe, pause the script for 15,000 milliseconds (15 seconds).

Step 3: The Get Outlook Emails command is used to collect all emails located in the Inbox folder (or any folder that the user chooses) that match the search criteria (in this case, the search was looking for the following email subject: ‘Move & Copying Email Test’). This command will pass those emails into a list variable (which is different than a regular variable because it contains a list of items rather than just a singular item) called ‘{vTest}’.

Step 4: The Loop Collection Command will loop through the list variable and grab one email at a time. From there, the loop will run the series of commands written in the loop on each item/email.

Step 5: The Move/Copy Outlook Emails command is used to move the email from the Inbox into the Test folder.

Newsletter Bot

Lets stay in touch!

Join our weekly newsletter and follow us on social media.

Contact Sales
Call Our Experts!