In PowerAutomate, when a flow has "When a new email arrives in a shared mailbox (V2)" trigger, for example, you notice any of the following:
- The flow is not triggering for all the emails that come into the mailbox
- The flow is not triggering for emails with attachments
- You get a 400 Bad Request or similar error in actions that use the trigger output attachment content bytes
By default, the trigger will have the following attachment-related options set to "No". This is because triggering on all mails doesn't miss any (you might want to trigger on emails without attachments too) and attachments can be large in size:
- "Only with Attachments"
- If set to "No", it will trigger on all emails. If "Yes", it will trigger on emails with attachments. Use the latter if your flow only needs to trigger on mails with attachments; otherwise, keep it set to "No".
- "Include Attachments"
- If set to "No", it will not include the attachments content (it will be set to null).
- For example, if set to "No" and you have a Sharepoint "Create File" action that uses the null attachment content, then this will result in "400 Bad Request" errors because the file content would be null, or empty, which is invalid.
- If set to "Yes", it will include the attachment content bytes instead of being null and Sharepoint "Create File" action, for example, will succeed and the file created will contain the attachment content.
Note: These are the default option values for the trigger output because attachments can be large in size.
To make the flow trigger also on emails that have attachments and to make the attachment content available to other actions (i.e. not to set contentBytes to null), in the trigger card:
- Expand "Show Advanced Options" by clicking on it
- Set "hasAttachments" to true
- Set "includeAttachments" to true
See associated screenshots for the above steps
Expand the "Show Advanced Options" by clicking on it:
Set "Include Attachments" to "Yes" to make the content available to other Power Automate actions.
Set "Only with attachments" to make the flow trigger only on emails with attachments.