One of the FAQs I see a lot is how to send Microsoft Form attachments to email and, in this walkthrough, we will go through every step with no steps skipped so you can do this yourself!
Here, I have a sample form with just two questions: Name and File Upload. In my example, the end-user can upload more than one file at a time - up to three to be specific. Here's the Microsoft Form.
So, once you have a Microsoft Form created, let's start building your flow.
The first step is to start creating a new automated power automate flow.
At make.powerautomate.com, click on Create, then select Automated Cloud Flow, then name your flow and select the trigger, "When a new response is submitted", then click on the Create button. Again, in the context of "no steps skipped", this is the automated trigger that will start the flow every time someone fills out your form.
Next, we need to configure the trigger by pointing to the Microsoft Form we just created. You will select this by name. Mine is called "Form with Attachment to Email", shown below.
Next, add your first action "Get response details" and configure as shown below. Here we are telling our automation when the flow starts, we want to get the form responses so we can use the submitted responses downstream in our flow. Select the form and then add the dynamic content Response ID from the trigger. In short, this links this action to the trigger, so think of it this way: when a new form response is submitted, get the form responses.
To add dynamic content, click on the field ResponseID then click on the lightning bolt that appears to the right of the field. You can also type "/" to open up the dropdown menu options too - both do the same thing.
Next, select the dynamic content, shown below.
So, when you flow looks like this, continue.
Next, add the action Initialize variable and name variable "attachments1" and the type is "array", shown below.
Ok, so at this point we are moving right along and ready to get some Form results so we can keep building the flow. Click on test in the top right and select manual and click on test button. Then fill out the form and add your name plus upload three sample files, shown below.
When you test flow runs, click on the action Get response details and look at the output. We are specifically looking for the JSON output from the question "Add a file", shown above. You want to copy the entire JSON string as shown below.
Next, add the action Parse JSON and in the Content field select the dynamic content (by putting your cursor in the field and selecting the lightning bolt or typing "/" and select "add a file" under the category Get response details. When you do that, your dynamic content may appear as something different such as body/r95456541236556, shown below.
The last step is to click on the link "Use sample payload to generate schema". Then we will paste in our copied JSON (the previous step) and paste it in and click Done. Your screen should like similar to the one shown below.
Next, add the action Get file content, shown below. Then add the dynamic content ID from your Parse JSON action. Notice when you do that, it will put this action in an apply to each (or for each) loop and that's because... for each attachment uploaded (remember, my form can have up to three in a single question), loop through each file and get the file content for each. So in my example here, because I uploaded 3 files, we will loop through this 3 times.
Next, the last step inside the apply to each (or for each) loop is add the action Append to array variable, shown below. Select the variable "attachments1" from the dropdown and type in the value exactly as it is shown below. Be sure to add the curly brackets at the beginning and the end and add the space after each such as "Name":
Select the dynamic content from Parse JSON and get the Name of the file and for ContentBytes, use the dynamic content from Get File content.
So be sure to add the curly brackets, the double quotes, semicolons, and the comma. You screen should look exactly like mine above.
Outside of the apply to each (or for each) loop, add the action Send Email V2 and configure as shown below. In the attachment item field, add the variable attachment1 as dynamic content.
Save and test. Notice below, my apply to each (or for each) loop ran through the loop 3 times, because we uploaded 3 files in the example.
In summary, you just learned one of the FAQs here - "How to Send Microsoft Form Attachments to an Email"! You learned about using a variable, appending a variable, parsing a JSON value from a form and using/accessing the values downstream, and sending all the attachments in a single email! Goes without saying, that was fun! #neverstoplearning #sharingiscaring #powerautomate #walkthroughs
My name is Thomas Rice (aka trice602) and if you have worked with me in the past, you know my email signature is "Always glad to help!". I hope you enjoyed this walkthrough.
Always glad to help! Tom ⭐⭐⭐⭐⭐