Skip to main content

Get Outlook Mail Messages

Description

Use this Activity to read mail messages from Outlook 365 inside your Microsoft 365 Tenant. To read emails, please provide at least read permissions (Mail.Read) to the App you created for Microsoft 365 Context.

note

This Activity works only inside Microsoft 365 Context Activity.

The body of this Activity provides the Filter button. The Email Filter Dialog pops up on clicking this button. You can optionally specify the criteria to fetch the mail messages from the specified Outlook 365 using this Email Filter Dialog.

info

If no filters are specified, the Activity will fetch all the mail messages from the selected Outlook 365.

Properties

Host

  • Account – Specify the mail account from which to retrieve the mail messages.
  • Mail Folder – Specify the mail folder from which to retrieve the messages.

Misc

  • DisplayName – Add a display name to your Activity.
  • Private – By default, Activity will log the values of your properties inside your workflow. If private is selected, then it stops logging.

Optional

  • Continue On Error – Specifies if the automation should continue even when the Activity throws an error. This field only supports Boolean values (True, False). The default value is False.
note

Catches no error if this Activity is present inside the Try-Catch block and the value of this property is True.

Options

  • Delete Messages – Specify the Boolean value true for deleting the read messages.
note

Before enabling this option, you must grant read and write permission (Mail.ReadWrite) to the registered App inside Microsoft 365 Tenant.

  • Mark Mail As Read – Specifies whether to mark retrieved messages as read.
note

Before enabling this option, you must grant read and write permission (Mail.ReadWrite) to the registered App inside Microsoft 365 Tenant.

Output

  • Messages – The retrieved messages as a collection of MailMessage objects.

Email Filters

Users can apply filter criteria to extract the needed emails using this dialog. The Activity provides the user to build the filter expressions.

Number of Records

Filter by the number of messages to retrieve. If not specified, returns all the mails which satisfy the filter condition.

Expression Grid

ColumnDescription
LogicSelect the logical conjunction to combine the expressions from the drop-down.
FilterFieldApply the filter from the drop-down on the selected field.
ConditionSelect the conditional operator to use in the expression from the drop-down.
ValueSpecify the value of the selected field to filter.

Logical Conjunctions

OptionDescription
ANDPerforms logical AND operation between the selected expressions.
ORPerforms logical AND operation between the selected expressions.

Email Filter Fields

FieldDescription
SubjectRetrieves emails that match the specified subject.
SenderRetrieves emails that match the specified email address.
Mail BodyRetrieves emails that match the words in the mail body.
ReceivedRetrieves emails that match the received Date of mail.
SentRetrieves emails that match the sent Date of mail.
Unread Mails OnlyRetrieves the unread emails.
Read Mails OnlyRetrieves the read emails.
Has AttachmentsRetrieves emails that contain attachments.
ImportanceRetrieves emails that match the specified priority in the mail. The value can be "MailPriority.Low", "MailPriority.Normal", or "MailPriority.High"

Building filter expressions

  • Click on the + button available in the dialog

  • Select the field from the drop-down on which you need to filter the emails

  • Select the conditional operator to be used from the drop-down

    note

    The conditional operator list dynamically changes based on the field selected.

  • Specify the value to be used for the filter

    note

    If you need to build a complex expression, you can add more terms by combining them with appropriate conjunctions.

  • Click on the + button

  • Select the conjunction from the drop-down

  • Continue building expressions

Example

Download Example

Get Outlook Mail Messages