Productivity Activities
Last updated Jul 9, 2024

Get Exchange Mail Messages


Retrieves an email message from Exchange.


  • DisplayName - The display name of the activity.
  • TimeoutMS - Specifies the amount of time (in milliseconds) to wait for the activity to run before an error is thrown. The default value is 30000 milliseconds (30 seconds).
Exchange settings
  • EmailAutodiscover - Searches automatically for an Exchange server by using an email address from that server. This works only if the Exchange server has Autodiscover enabled.
  • ExchangeVersion - Specifies the lowest version of the Exchange server that is used. The options displayed in this field range from 2007 to the 2013 version. Please note that the version number indicates the lowest level of service you support. This means that if you have a 2016 exchange server, you can select the Exchange2013 option.
  • Server - The email server host that is to be used.
  • Domain - The Active Directory domain to connect to.
  • Password - The password of the Exchange account used to retrieve the message.
  • SecurePassword - The password of the Exchange account used, as a secure string.
  • User - The username of the Exchange account used to retrieve the message.
  • Private - If selected, the values of variables and arguments are no longer logged at Verbose level.
Office 365 settings
  • ApplicationId - The ID of your Azure Active Directory Application. This field supports only strings and String variables.
  • AuthenticationType - The authentication options for Office 365. The available options are:
    • UserNameAndPassword - Standard Username and Password Login.

      Important: The ApplicationID property is required when selecting UserNameAndPassword authentication. This ensures ROPC authentication is used instead of basic authentication, which has been deprecated in Exchange online.
    • Interactive - Interactive Token (Auth 2.0).
    • Windows Integrated - Integrated Windows Authentication.
  • DirectoryId - The ID of your Azure Active Directory. This field supports only strings and String variables.
  • FilterByMessagesIds - Returns only those mail messages with the specified message IDs. If set, then the FilterExpression parameter is ignored. This field supports only String[] variables.
    Note: Filtering by message IDs is supported starting with Exchange Server 2013.
  • FilterExpression - Returns only those mail messages matching the filter expression.
    Note: The filter expression can be used starting with Exchange Server 2010.
  • GetAttachments - Specifies whether to retrieve the attachments in the email message. By default, this check box is cleared.
    Note: For Exchange Server 2007 SP1, the activity returns all attachments, including inline attachments. This is a limitation of the Exchange API.
  • IsBodyHtml - Specifies whether the body of the message is written in HTML format.
  • MarkAsRead - Specifies whether to mark retrieved messages as read. By default, this check box is cleared.
  • OnlyUnreadMessages - Specifies whether to retrieve only unread messages. By default, this check box is selected.
  • OrderByDate - Order mail messages by date. Choose one of two options: Newest First, Oldest First. The default value is Newest First.
  • Top -The number of messages to be retrieved, starting from either the newest or the oldest, depending on the OrderByDate parameter.
  • Messages - The retrieved messages as a collection of MailMessage objects.
    Note: Starting with UiPath.Mail.Activities version 1.10.4, the MailMessage object exposes:
    • The Message-ID of a mail message, for example MailMessage.Headers("Message-ID").
    • The Categories associated with a mail message, for example MailMessage.GetCategories().
  • MailFolder - The mail folder from which the messages are to be retrieved.
    • To retrieve emails from a public folder, the value of the MailFolder field should be exactly as the name of the public folder that is displayed in Favorites.
    • When using a public folder, if there is a personal folder in the mailbox with the same name, the activity returns the emails from the personal folder. In order to return the emails from the public folder, the personal folder must be renamed.
    • The activity does not support Posts items. If there are Posts items in the public folder, the activity will fail unless you specify a proper filter expression, for example, FilterExpression = “kind:emails”.
  • SharedMailbox - Enables the retrieving of messages from a shared mailbox linked to an Exchange user account.

Filtering examples

The following table shows examples of filters that can be useful when you query Exchange mail messages:


Filter Expression

All mail messages that contain "welcome" in the subject


All mail messages that contain "welcome" in the subject and are from ""

"subject:welcome AND from:"""""

All mail messages from an email account from


All mail messages that contain "please review" in the body

"body:please review"

All mail messages with attachments


All mail messages with high importance having a pdf file attached

"importance:high AND attachments:.pdf"

All mail messages having 'Red category' and 'Blue category' as their categories

"category:Red category, Blue category"

All mail messages of type meeting (e.g. calendar invites, responses)


All mail messages received today


All mail messages received on 10/23/2020


All mail messages received since 10/23/2020

"received: >=10/23/2020"

Note: To learn about how to specify a filter expression, please read Perform an AQS search by using EWS in Exchange.
  • Properties
  • Filtering examples

Was this page helpful?

Get The Help You Need
Learning RPA - Automation Courses
UiPath Community Forum
Uipath Logo White
Trust and Security
© 2005-2024 UiPath. All rights reserved.