web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Automating "File Uploa...
Power Automate
Unanswered

Automating "File Upload" Filename in Microsoft Forms

(1) ShareShare
ReportReport
Posted on by 13

Hi All,

Hope everyone reading this is keeping well and healthy.

 

I have a Microsoft Form with 4 x Fields & 1 x Upload File option

Field 1 - Report Type

Field 2 - Product Name

Field 3 - Serial No

Field 4 - Tested By

 

Is there any flow which I can use to rename the uploaded file with a name which it fetches from the form itself. For example, the name to be achieved may look like "Report Type""Product Name""Serial No""Tested By"

 

I am not a coding expert and trying to learn this stuff. Can you advice on how I can achieve this using the automation flows?

 

Many Thanks to you!

 

Categories:
I have the same question (0)
  • rsymmons Profile Picture
    222 on at

    I think this can be achieved by using the "create a file" function using the SharePoint or OneDrive connector but you will run into difficulties with filetypes if you allow different filetypes to be uploaded. For example, when you use the create a file function, part of the requirement is to define a filename.filetype. As you will be pulling the filename section using the form fields this is easily done, however you will need to hard set a file type, this causes issues if someone uploads an image but you set the automation to use .doc etc. 

     

    We could possibly use some JSON to extract the original filename.filetype from the uploaded files and then apply that to the end of the criteria you want. e.g. "Report Type""Product Name""Serial No""Tested By".filename.filetype

  • Gautam_sehgal Profile Picture
    13 on at

    Hello Rsymmons,

     

    Thank you for the the suggestion. I am unfortunately not able to figure out the right rules to use for picking the file uploaded with the form. Once done, then I'd be able to try what you suggested.

     

    Cheers!

  • Verified answer
    rsymmons Profile Picture
    222 on at

    See image below.

     

    This should work:

     

    1) Under ParseJSON select the file upload question from the form as the "content" and then paste this in the schema:

     

    {
        "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"
            ]
        }
    }

     

    2) When using "Get file content using path", manually type in the path to where the file is stored in OneDrive, Typicaly the default location is: "/Apps/Microsoft Forms/name of form/name of question". Then put the following expression at the end of that path:

     

    first(body('Parse_JSON'))?['name']
     
    3) Create a file using SharePoint or OneDrive, under filename use the dynamic fields from the form such as answer1.answer2 and then use the JSON name field. It should look something like Answer1.Answer2.Answer3.Name
     
    4) File content use the OneDrive file dynamic content 

     

    rsymmons_0-1597314255959.png

     

  • v-bacao-msft Profile Picture
    on at

     

    Hi @Gautam_sehgal ,

     

    Please refer to the following video to get the attachment from the form submission:

    https://www.youtube.com/watch?v=Foy8i6jPZrg

     

    Best Regards,

  • Gautam_sehgal Profile Picture
    13 on at

    Hello @rsymmons

     

    Thank you for breaking down the process for me. The flow runs successfully by now.

     

    This is how the file name after the output looks like  "Answer1,Answer2MyTestFile_Gautam Sehgal.pdf"

     

    Is there any possibility where I can get the file name like "Person1 Jumper.pdf" which come from the form field as shown in the image below!

    Form Capture.PNG

     

    Many thanks

    Gautam Sehgal

  • Gautam_sehgal Profile Picture
    13 on at

    Hello @v-bacao-msft - Thank you for the video, it's very informative. Although I need to automate the rename process where the name is picked from the filled form.

     

    Thank you

    Gautam Sehgal

  • rsymmons Profile Picture
    222 on at

    @Gautam_sehgal check the “create file” section and “file name” in the image I provided previously. This is easily done. 

  • rsymmons Profile Picture
    222 on at

    I know that OneDrive adds the authenticated user’s email address on the end of the file uploaded. I think the only way of overwriting this would be to create the file using your own naming criteria but again this would cause issues with the file type. 

    for example, when creating a file under file name put field1.field2.filetype. This would hard set the filetype though so only documents of a certain type would be accepted eg PDFs

  • Gautam_sehgal Profile Picture
    13 on at

    @rsymmons - Thank you so much, I was creating the file incorrectly. This is done and I appreciate your support on this.

    I've got the desired results.

     

    Cheers !

    Many thanks & Regards

    Gautam Sehgal

  • rsymmons Profile Picture
    222 on at

    @Gautam_sehgal  My pleasure glad you've got  it working 🙂 

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 522 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 364 Moderator

#3
abm abm Profile Picture

abm abm 243 Most Valuable Professional

Last 30 days Overall leaderboard