RPA.Outlook.Application

Outlook.Application is a library for controlling the Outlook application.

About Email Filtering

Emails can be filtered according to specification set by Restrict method of the Item class https://docs.microsoft.com/en-us/office/vba/api/outlook.items.restrict.

Couple of examples:

Get Emails ... email_filter=[Subject]='test email' Move Emails ... email_filter=[SenderEmailAddress]='hello@gmail.com'

Examples

Robot Framework

*** Settings *** Library RPA.Outlook.Application Task Setup Open Application Suite Teardown Quit Application *** Variables *** ${RECIPIENT} address@domain.com *** Tasks *** Send message Send Message recipients=${RECIPIENT} ... subject=This is the subject ... body=This is the message body .. attachments=approved.png

Python

from RPA.Outlook.Application import Application def send_message(): app = Application() app.open_application() app.send_message( recipients='EMAILADDRESS_1, EMAILADDRESS_2', subject='email subject', body='email body message', attachments='../orders.csv'

For more information, see: https://docs.microsoft.com/en-us/previous-versions/office/developer/office-2007/bb219950(v=office.12)

Caveats

This library works on a Windows operating system with UI enabled only, and you must ensure that you open the app first with Open Application before running any other relevant keyword which requires to operate on an open app. The application is automatically closed at the end of the task execution, so this can be changed by importing the library with the autoexit=${False} setting.

*** Settings *** Library RPA.Excel|Outlook|Word.Application autoexit=${False}

If you're running the Process by Control Room through a custom self-hosted Worker service, then please make sure that you enable an RDP session by ticking "Use Desktop Connection" under the Step configuration.

If you still encounter issues with opening a document, please ensure that file can be opened first manually and dismiss any alert potentially blocking the process.

Check the documentation below for more info:

Importing

Initialize the library instance by wrapping the COM Windows app.

param autoexit:Automatically close the app when the process finishes.