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.
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.
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.
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.
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.
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
Column | Description |
---|---|
Logic | Select the logical conjunction to combine the expressions from the drop-down. |
FilterField | Apply the filter from the drop-down on the selected field. |
Condition | Select the conditional operator to use in the expression from the drop-down. |
Value | Specify the value of the selected field to filter. |
Logical Conjunctions
Option | Description |
---|---|
AND | Performs logical AND operation between the selected expressions. |
OR | Performs logical AND operation between the selected expressions. |
Email Filter Fields
Field | Description |
---|---|
Subject | Retrieves emails that match the specified subject. |
Sender | Retrieves emails that match the specified email address. |
Mail Body | Retrieves emails that match the words in the mail body. |
Received | Retrieves emails that match the received Date of mail. |
Sent | Retrieves emails that match the sent Date of mail. |
Unread Mails Only | Retrieves the unread emails. |
Read Mails Only | Retrieves the read emails. |
Has Attachments | Retrieves emails that contain attachments. |
Importance | Retrieves 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
noteThe conditional operator list dynamically changes based on the field selected.
-
Specify the value to be used for the filter
noteIf 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