Office 365: Email Message Input
Description
This step retrieves emails from a Microsoft 365 mailbox based on filter criteria. You specify the mailbox, folder, and filter conditions. This is a row-generating step that returns matching emails for processing by subsequent steps. Use this step in workflows that poll for new emails, process incoming messages, or collect email data for reporting.
Note:
- For MFA enabled user account. Select Grant Type as Refresh Token.
- If the emails need to be marked as read, then you need to provide the ‘Mail.ReadWrite’ permission.
Permission:
-
Office 365 Email Messages Input Step needs the following permissions to fetch emails.
Permission type Permission (from least to most privileged) Delegated Mail.ReadBasic, Mail.Read Delegated offline_access -
To access a shared mailbox, verify the following configurations are complete:
- Provide admin consent for the corresponding delegated *.Shared Microsoft Graph permissions
Mailbox permission on the shared mailbox Delegated Graph permission (app registration) Full Access Mail.Read.Shared
- Provide admin consent for the corresponding delegated *.Shared Microsoft Graph permissions
Configurations
| No. | Field Name | Description |
|---|---|---|
| 1 | Step Name | Name of the step. This name has to be unique in a single workflow. |
| Connection: | For details about app registration, see Office 365 App Registration for Grant Type – Password Grant or Office 365 App Registration for Grant Type Refresh Token | |
| 2 | Grant Type | Select the type of grant from Password Grant or Refresh Token. The data type is string. This field is mandatory. Note: It is recommended to select the grant type from Refresh Token. |
| 3 | Tenant ID | Tenant ID of Microsoft Account. The data type is string. This field is mandatory. |
| 4 | Client ID | Client ID of the Application created in Microsoft Account. The data type is string. This field is mandatory. |
| Client Secret: | ||
| 5 | Accept Value as variable/static | Leave checkbox unchecked to accept Client Secret value from a field in the previous steps of the stream using a drop down list. Else enable checkbox for Client Secret field to appear as Text box. |
| 6 | Client Secret | Specify the Client Secret generated in Microsoft Account. Client Secret is entered using a widget. The widget handles both Text (static value or environment variable) and Combo (drop down containing values from previous steps). If checkbox above is enabled Client Secret field appears as a Text box and accepts static or variable values. Else if checkbox above is disabled Client Secret field appears as a drop down to select fields from previous steps. The data type is secure string. This field is mandatory. |
| 7 | Username | Specify the name of the user whose email attachments are to be downloaded. |
| 8 | Password | Specify the password for the provided user name. |
| 9 | Refresh Token | Specify the refresh token required to authenticate the details. |
| 10 | Button: Test Connection | Test connection with Client ID and Client Secret provided. Verifies whether the connection is established or not. Note: For the purpose of verification fields coming from previous steps are not allowed since field values can only be accessed when workflow is in running state. Static values and environment variables are allowed. |
| General Tab: | ||
| Input Fields: | ||
| 1 | Shared Mailbox Email | Specify a shared mailbox address to Reads inbox emails from the shared mailbox. Leave the field blank to read email for the currently authenticated account. Note: The authenticated account must have access permissions for the shared mailbox, else the step fails and returns a Microsoft Graph permission error. The field accepts variable/static values |
| 2 | Folder | Specify the folder of which emails are to be fetched. Provide folder name, such as, folder1/folder2/folder3…folder. The data type is String. This field is mandatory. Note: It must be a valid email folder and the folder name must not contain slash(/). |
| 3 | Get | Click to display a list of folders for email account. Known issue: The folder structure may not be correct when fetched and selected through Get. Note: Verify the folder structure when selected through Get. Recommendation: For multi-level folder structure, pass the folder structure directly to the field instead of selecting through Folder Explorer, which appears after you click Get. |
| 4 | Retrieve | Select from the following retrieve options: - Get All Messages - Get unread messages. |
| 5 | Retrieve The Top ... Emails | Provide the positive integer value to fetch top n emails. This field is optional. Retrieve The Top ... Emails value is ignored if ‘Fetch in Batches’ below is ‘Yes’. |
| 6 | Retrieve Emails In Reverse Order | Allowed values: 'Yes', 'No'. Provide ‘Yes’ to fetch in reverse order i.e. Old to New. This field is optional. |
| 7 | Mark As Read | Allowed values: 'Yes', 'No'. Provide ‘Yes’ if fetched mails are to be marked as read. This field is optional. |
| 8 | Default Character | Limit For Test Extraction Specify the character limit to read the email body. Default value: 1000000 |
| Batch: | ||
| 1 | Fetch in Batches | Allowed values: 'Yes', 'No'. Provide ‘Yes’ to fetch in batches. Note: • If Retrieve Emails In Reverse Order and Fetch In Batches both are selected then the batches are reversed. • Retrieve The Top ... Emails value is ignored if ‘Fetch in Batches’ below is ‘Yes’. • Batch Size and Limit will be considered only if Fetch in Batches is ‘Yes’. |
| 2 | Batch Size | This field is enabled if the checkbox above is selected. Provide the positive integer value for the size of the batch to be fetched. If ‘Yes’ is provided in ‘Fetch in Batches’ field above, a value must be provided. |
| 3 | Limit | Provide a positive integer which is an upper limit for the total number of emails to fetch. You may optionally provide a value if Yes is provided in field ‘Fetch in Batches above. |
| **Filters Tab: ** | ||
| Header: | Note: If multiple filters are used from the below list, then AND operator is used for filters. The data type of all fields in the Header is String. The fields are optional. | |
| 1 | Sender | Provide the mail address to filter mails by Sender. |
| 2 | Recipient | Provide the mail address to filter mails by Recipient |
| 3 | Subject | Provide the value to filter mails by Subject. |
| 4 | Category | Provide the value to filter mails by Category. |
| 5 | Has Attachments | Provide the value to filter the emails with attachments. Allowed value: ‘True’ or ‘False’. |
| 6 | Search Text | Provide the value to search the text in either of Body, Sender, or Subject. |
| Received date: | ||
| 7 | Condition | Select the condition to filter mail by received date. Allowed values are: 'None', 'Equal to', 'Smaller than', 'Greater than', 'Between...and...'. Date values below are not considered if Condition is ‘None’/Blank. |
| 8 | Date1 | Provide the Date1 (yyyy-MM-dd) for the provided condition. |
| 9 | Date2 | Provide the Date2 (yyyy-MM-dd) only if Between conditions is selected. Note: - Validate Date1 and Date2 based on the selected condition for Received Date. - Date values below are not considered if Condition is ‘None’/Blank. - Date1 value must be smaller than Date 2 value if Received Condition is 'Between...and...'; and if Date1 value is greater than Date 2 value then the workflow executes successfully without any output. |
| Advanced Filter | Note: • Selecting Use Advanced Filter disables Header and Received Date group fields. • Advanced Filter bypasses the ~270-email limit and supports @odata.nextLink pagination. • Selecting Get unread messages from the Retrieve field automatically adds the isRead eq false condition to the existing filter expression. Important: • Clear the Use Advanced Filter checkbox and use standard search fields to: o Find To/CC/BCC recipients. o Perform email body searches. o Evaluate properties using the endswith operator. • Do not combine $orderby with startswith subject queries. Use Reverse Order to sort results from General tab.• For shared mailboxes, use the Shared Mailbox Email field instead of a recipient filter. • The step fails if the Filter expression or its variables resolve to empty. • Date evaluations require full ISO-8601 formatting with a time zone (for example, 2026-05-01T00:00:00Z). Reference: • Microsoft Graph $filter documentation: Use the $filter query parameter to filter a collection of objects • Microsoft Graph messages resource: message resource type - Microsoft Graph v1.0, Microsoft Learn | |
| 1 | Use Advanced Filter | Select the checkbox to define a single, custom search query instead of using the standard filter fields (Sender, Subject, Date, etc.). The step fetches only the messages that match the exact filter string. |
| 2 | Filter | Specify a Microsoft Graph filter expression to find specific emails. The advanced filter bypasses the standard email limit and returns all matching results. The field supports operators, such as eq, startswith, contains, ge, le, and, or, not, and to evaluate properties such as subject, from/emailAddress/address, hasAttachments, and receivedDateTime. Note: The field is available only when the Use Advanced Filter checkbox is selected Example: from/emailAddress/address eq 'abc@xyz.com' startswith(subject,'Report') from/emailAddress/address eq 'abc@xyz.com' and startswith(subject,'Report') hasAttachments eq true and isRead eq false receivedDateTime ge 2026-05-01T00:00:00Z and receivedDateTime le 2026-05-31T23:59:59Z |
| Output Fields: | This is a tabular list. | |
| 1 | Field Name | Click on a field in the Name column to open the Select Fields Name pop-up window explorer and select email properties to fetch You may select multiple properties. The data type is String. At least one field must be selected. |
| 2 | Output Field Name | Specify an Output Field Name to hold the corresponding value of the Field Name selected above. The data type is String. This field is mandatory. |
| 3 | Keep HTML Tags in the Body | Select the checkbox if you want the HTML tags to be displayed for the mail body. Note: The checkbox is clear by default. |