Power Community

Power Community

Send Microsoft Form Attachments to an Email – End to End Walkthrough

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.

trice602_0-1706291471677.png

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.

trice602_2-1706291756449.png

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.

trice602_1-1706291635554.png

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.

trice602_4-1706292314801.png

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.

trice602_5-1706292505033.png

Next, select the dynamic content, shown below.

trice602_7-1706292580380.png

So, when you flow looks like this, continue.

trice602_9-1706292669486.png

Next, add the action Initialize variable and name variable “attachments1” and the type is “array”, shown below.

trice602_10-1706292751276.png

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.

trice602_13-1706293157343.png

trice602_11-1706292909958.png

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.

trice602_12-1706293067037.png

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.

trice602_14-1706293413891.png

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.

trice602_15-1706293914297.png

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.

trice602_16-1706294140396.png

 

 

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.

 

trice602_17-1706294499817.png

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.

Microsoft Form Attachments to Email  - Complete FlowMicrosoft Form Attachments to Email – Complete Flow

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.   

trice602_18-1706295007997.png

Always glad to help!  Tom

This post was originally published on this site

- Advertisement -spot_img

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisement - Advertisement

Latest News

Adjusting the time zone in Power BI DAX – Quick Tip

Hi Folks, Here is the use case, I was actually pulling data from Model Driven App. As I was testing...

More Articles Like This

- Advertisement -spot_img