Pragmatic Works Nerd News

Count Email Attachments and Add to SharePoint list with Power Automate

Written by Jonathon Silva | Aug 14, 2026

In this tutorial, Jonathon Silva demonstrates how to count email attachments in Office 365 Outlook and store them in a SharePoint list using Power Automate. This step-by-step guide covers the setup process, the necessary actions, and how to ensure the email attachments are counted and recorded properly.

 

Setting Up the Flow in Power Automate

The first step is to create a new flow in Power Automate. Jonathon starts by selecting the trigger that will monitor the inbox for new emails. The flow will only run when an email with attachments is received. To enable this, the advanced options in Power Automate must be configured to include attachments.

Using Variables to Count Attachments

Jonathon explains the importance of initializing variables in Power Automate. He sets up a variable named attachment count to keep track of the number of attachments in an email. The variable is initialized with a value of zero, and the flow will increment this variable for each attachment found in the email.

Getting Attachments with "Get Attachment" Action

Jonathon then demonstrates how to use the Get Attachment action from Office 365 Outlook to retrieve the attachments of the email. This action ensures that all attachments, regardless of quantity, are captured. By using the dynamic content from the email’s message ID and attachment ID, the flow can retrieve and process all attachments.

Using "Apply to Each" Loop to Count Attachments

To handle multiple attachments, Jonathon uses the Apply to Each loop, which iterates through each attachment in the email. This loop runs the defined actions for each attachment, allowing the flow to count the attachments one by one. Inside the loop, an increment action adds one to the attachment count variable for each attachment processed.

Testing the Flow and Verifying Results

Jonathon proceeds to test the flow by sending an email with multiple attachments. Once the flow runs, the attachment count variable is updated, showing the correct number of attachments. The loop ensures that all attachments are counted correctly, and Jonathon demonstrates how the count is verified during the flow’s execution.

Storing the Attachment Data in SharePoint

After counting the attachments, Jonathon adds an action to store the data in a SharePoint list. A new item is created in the list for each email received, and the attachment count is recorded. Jonathon shows how to dynamically populate the SharePoint list with information like the sender’s name, subject, and the total attachment count.

Adding Attachments to SharePoint List Items

To complete the process, Jonathon demonstrates how to attach the actual files to the SharePoint list item. Using the Add Attachment action, the flow adds the attachment files to the list item. Additionally, the attachment count is updated after the loop completes, ensuring that the list item is accurate with all relevant data.

Final Verification and Conclusion

Finally, Jonathon reviews the results of the flow in SharePoint. He shows that the email’s attachment data, including the count and the attachments themselves, are successfully stored in the SharePoint list. The process is complete, and Jonathon encourages viewers to use this method to automate their email attachment management and storage in SharePoint.

In this video, Jonathon Silva from Pragmatic Works effectively demonstrates how to use Power Automate to count email attachments and store them in a SharePoint list, automating an otherwise tedious process. By following these steps, users can easily manage and track email attachments in a structured and efficient manner.

Don't forget to check out the Pragmatic Works' on-demand learning platform for more insightful content and training sessions on Power Automate and other Microsoft applications. Be sure to subscribe to the Pragmatic Works YouTube channel to stay up-to-date on the latest tips and tricks.