Subscribe

UiPath Activities

The UiPath Activities Guide

Get Exchange Mail Messages

UiPath.Mail.Exchange.Activities.GetExchangeMailMessages

Retrieves an email message from Exchange.

Properties

Common

  • 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.

Logon

  • 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.

Misc

  • 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.
    • 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.

Options

  • 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.
  • 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.

Output

  • 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().

Target

  • MailFolder - The mail folder from which the messages are to be retrieved.

🚧

Note:

  • 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:

Query

Filter Expression

All mail messages that contain "welcome" in the subject

"subject:welcome"

All mail messages that contain "welcome" in the subject and are from "john.smith@example.com"

"subject:welcome AND from:""john.smith@example.com"""

All mail messages from an email account from example.com

"from:example.com"

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

"body:please review"

All mail messages with attachments

"hasattachment:true"

All mail messages with high importance having a pdf file attached

"importance:high AND attachment:.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)

"kind:meetings"

All mail messages received today

"received:today"

All mail messages received on 10/23/2020

"received: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.

Updated 18 days ago


Get Exchange Mail Messages


Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.