There is a question type in Microsoft Forms that allows the responder to upload a file. This file is automatically uploaded to OneDrive. With Power Automate, you can build a flow that will extract the responses to questions in a form, including a link to file attachments, then send it in an email.

Screenshot of Form and email with link to uploaded file
Screenshot of Form with file upload question

1. Capture response details

In Power Automate, begin with a flow as shown below. The trigger should be Microsoft Forms- When a new response is submitted, followed by the Microsoft Forms action- Get response details. The Form Id should be your form that contains a file upload-type question. Select Response Id dynamic content for the Response Id field.

Screenshot of Microsoft Forms trigger and action in flow

2. Extract the uploaded file link

The Get response details action allows you to dynamically insert the responses for each question throughout the flow. However, for file-upload questions, the output will look something like this:

[{“name”:”filename”,”link”:https://xiad-my.sharepoint.com/personal/admin_xiad_onmicrosoft_com/Documents/Apps/Microsoft%20Forms/Registration%20form/Question/filename.jpg“,”id”:”01QDBDAG644VZTIX6WYJCLW4VJOMLUNIX2″,”type”:null,”size”:235917,”referenceId”:”01QDBDAG7M3KZCH6RFN5FIFSPTPO2XOEMS”,”driveId”:”b!UeqjQ_JEXkO5R3k81joAiRztGBIj6XpOv-7pRMWWeqMqDiCn_2cxTowxCQzymyBG”,”status”:1,”uploadSessionUrl”:null}]

The highlighted part above is the URL to the file, which is the only required part in order to provide a hyperlink to access the file in your email. To extract this URL, you will need to use an expression.

Add Compose action. Within the Inputs field, select the expression tab and start typing in the following expression:

split(
Screenshot of typing expression in Compose action

With your cursor still in the expression, click on the Dynamic content tab and select the question that contains a file upload.

Your expression will now looks something like this (apart from the red text below, this will be unique):

split(outputs('Get_response_details')?['body/rdf05a1f425794dfb9be8157fd335be2f']
Screenshot of selecting dynamic content while typing expression

With your cursor at the end of the expression, type in the following then click OK.

, '"')[7]
Screenshot of typing expression

All up, the expression used in this step will look like:

split(outputs('Get_response_details')?['body/rdf05a1f425794dfb9be8157fd335be2f'], '"')[7]

3. Send email with link to file

Add in the last step, Outlook- Send an email (V2). Fill in the details for the action. In the body, you can click on the form questions from the dynamic content list to insert the responses. Do this for the questions you want, except for the file upload question. For this, select the Outputs dynamic content coming from the Compose action.

Screenshot of Send an email action, and selecting Outputs dynamic content

You will need to switch to code view for the file link to appear as a clickable hyperlink. Click on the </> button to switch to code view.

Screenshot of clicking code view button on Send an email action

Type in the highlighted parts as shown below. Make sure there are no spaces or line breaks when you type it in. You will type <a href=”Outputs dynamic content“>Click to view</a>

Screenshot of adding code to Send an email action

Save your flow, then test it by submitting a response to your form.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s