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

{
    "type": "object",
    "properties": {
        "type": {
            "type": "string"
        },
        "items": {
            "type": "object",
            "properties": {
                "type": {
                    "type": "string"
                },
                "properties": {
                    "type": "object",
                    "properties": {
                        "name": {
                            "type": "object",
                            "properties": {
                                "type": {
                                    "type": "string"
                                }
                            }
                        },
                        "link": {
                            "type": "object",
                            "properties": {
                                "type": {
                                    "type": "string"
                                }
                            }
                        },
                        "id": {
                            "type": "object",
                            "properties": {
                                "type": {
                                    "type": "string"
                                }
                            }
                        },
                        "type": {
                            "type": "object",
                            "properties": {}
                        },
                        "size": {
                            "type": "object",
                            "properties": {
                                "type": {
                                    "type": "string"
                                }
                            }
                        },
                        "referenceId": {
                            "type": "object",
                            "properties": {
                                "type": {
                                    "type": "string"
                                }
                            }
                        },
                        "driveId": {
                            "type": "object",
                            "properties": {
                                "type": {
                                    "type": "string"
                                }
                            }
                        },
                        "status": {
                            "type": "object",
                            "properties": {
                                "type": {
                                    "type": "string"
                                }
                            }
                        },
                        "uploadSessionUrl": {
                            "type": "object",
                            "properties": {}
                        }
                    }
                },
                "required": {
                    "type": "array",
                    "items": {
                        "type": "string"
                    }
                }
            }
        }
    }
}

Create another new step and find Get file content using path

You will use the following Expression code at the end

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