cancel
Showing results for 
Search instead for 
Did you mean: 
Pstork1

Emailing File Attachments from Forms with Power Automate

I’ve seen some questions recently on the Power Platform Forums about how to send multiple attachments submitted in Microsoft Forms in an email.  Since this seems to be a common problem I thought it would be good to walk through the steps in a BLOG post.

  1. Once you have a Microsoft Form created that includes a question with an attachment you can create a new Power Automate Flow that uses the “When a new response is submitted” trigger.  That will start your flow each time a response is submitted through Microsoft Forms. But the trigger alone won’t provide enough detail about what is in the response.  So you also need to add a “Get response details” action to retrieve the questions and the answers submitted in the form.
    image.png
  2. In order to submit more than one file attachment to the email you will need to create an array to hold the name and content of each file.  To do this we “Initialize a variable” of type array.  We will supply values for the array later in an “Apply to each” loop.
    image.png
  3. Now you are ready to retrieve the details of the files attached to the question in the response and add them to the array.  To do that you need to use “Parse JSON” to parse the contents of the question in the response where the files were uploaded. Run your flow once at this point to get some sample output that you can use to generate the JSON schema.  Then add your question content to the Parse JSON.
    image.png
  4. Files uploaded to a Microsoft Form are automatically stored in the Form creator’s OneDrive for Business account.  So now that we have access to the details of those files from the Parse JSON action we can retrieve the file content from OneDrive and append it to the Array we created in Step #2.  We’ll use the file id to retrieve the file and then add the Name of the file and the File content to the array. Whether there is one file or multiple files the details will be in an array, so we’ll need to use an “Apply to each” loop to get each file and append it. The File content can ge used directly as we retrieve it from OneDrive.  No translation to Base64 is required because the file is retrieved as JSON, not binary.
    image.png
  5. Now that we have the file content in an array we can send the email.  Be sure to click on the selector in the attachments section to switch from detail inputs to an array item.  Then just fill out the email and add the array variable to the Attachments field.
    image.png

Now you can save and test your flow by filling out the Microsoft Form and uploading one or more attachments to the form.  In under 5 minutes you should get an email with the attachments from the form.

Comments
About the Author
  • Experienced Consultant with a demonstrated history of working in the information technology and services industry. Skilled in Office 365, Azure, SharePoint Online, PowerShell, Nintex, K2, SharePoint Designer workflow automation, PowerApps, Microsoft Flow, PowerShell, Active Directory, Operating Systems, Networking, and JavaScript. Strong consulting professional with a Bachelor of Engineering (B.E.) focused in Information Technology from Mumbai University.
  • I am a Microsoft Business Applications MVP and a Senior Manager at EY. I am a technology enthusiast and problem solver. I work/speak/blog/Vlog on Microsoft technology, including Office 365, Power Apps, Power Automate, SharePoint, and Teams Etc. I am helping global clients on Power Platform adoption and empowering them with Power Platform possibilities, capabilities, and easiness. I am a leader of the Houston Power Platform User Group and Power Automate community superuser. I love traveling , exploring new places, and meeting people from different cultures.
  • Read more about me and my achievements at: https://ganeshsanapblogs.wordpress.com/about MCT | SharePoint, Microsoft 365 and Power Platform Consultant | Contributor on SharePoint StackExchange, MSFT Techcommunity
  • Encodian Owner / Founder - Ex Microsoft Consulting Services - Architect / Developer - 20 years in SharePoint - PowerPlatform Fan
  • Founder of SKILLFUL SARDINE, a company focused on productivity and the Power Platform. You can find me on LinkedIn: https://linkedin.com/in/manueltgomes and twitter http://twitter.com/manueltgomes. I also write at https://www.manueltgomes.com, so if you want some Power Automate, SharePoint or Power Apps content I'm your guy 🙂
  • I am the Owner/Principal Architect at Don't Pa..Panic Consulting. I've been working in the information technology industry for over 30 years, and have played key roles in several enterprise SharePoint architectural design review, Intranet deployment, application development, and migration projects. I've been a Microsoft Most Valuable Professional (MVP) 15 consecutive years and am also a Microsoft Certified SharePoint Masters (MCSM) since 2013.
  • Big fan of Power Platform technologies and implemented many solutions.
  • Passionate #Programmer #SharePoint #SPFx #M365 #Power Platform| Microsoft MVP | SharePoint StackOverflow, Github, PnP contributor
  • Web site – https://kamdaryash.wordpress.com Youtube channel - https://www.youtube.com/channel/UCM149rFkLNgerSvgDVeYTZQ/