I had a task where I wanted to create a flow (power automate) that took a file uploaded in MS forms and copied it to a SharePoint document location.

When you create a Upload file question there is a new folder that gets added into your OneDrive called Apps. If you are using a group form in SharePoint then the folder will be located on that site. I won’t be covering that I will be covering the OneDrive location.

I have this question on my form:

The location in OneDrive is /Apps/Microsoft Forms/FormName/Question 1

Here is the high view of the power automate flow we will be creating:

First create a new Automated cloud flows – from blank

Select When a new response is submitted and click Create

Click New Step and find Get Response details

Create a new step and search for Parse JSON

For schema copy this information and paste it in the schema location

Schema Code

{ “type”: “array”, “items”: { “type”: “object”, “properties”: { “name”: { “type”: “string” }, “link”: { “type”: “string” }, “id”: { “type”: “string” }, “type”: {}, “size”: { “type”: “integer” }, “referenceId”: { “type”: “string” }, “driveId”: { “type”: “string” }, “status”: { “type”: “integer” }, “uploadSessionUrl”: {} }, “required”: [ “name”, “link”, “id”, “type”, “size”, “referenceId”, “driveId”, “status”, “uploadSessionUrl” ] } }

Create another new step and find Get file content using path

You will use the following Expression code at the end

Expression Code

first(body(‘Parse_JSON’))?[‘name’]

Create a new step and select Create file

File name is the name you want to call the new file. You can use dynamic content to manipulate this hundreds of ways

For the File Content field select File content under Get file content using path

The next step is optional. I don’t want the old file in my OneDrive so I added a Delete file step

You will enter the code below (be sure to include the . between the expressions)

Step 1 Expression

first(body(‘Parse_JSON’))?[‘driveId’]

.

Step 3 Expression

first(body(‘Parse_JSON’))?[‘id’]

Save your work then try it out. Let me know if you have any questions!

References:
https://powerusers.microsoft.com/t5/Building-Flows/Working-with-files-from-the-Forms-quot-File-Upload-quot-question/m-p/429351#M50149
https://powerusers.microsoft.com/t5/Building-Flows/Forms-Upload-File-to-OneDrive-with-File-Name-and-Folder-Name/td-p/564927
https://www.loryanstrant.com/2019/11/16/microsoft-forms-now-supports-attachment-uploads/
https://www.bythedevs.com/post/working-with-files-on-ms-forms-in-ms-power-automate