Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Automate - Building Flows
Answered

Multiple file uploads from 1-8x different MS Form questions, including "null" uploads

(1) ShareShare
ReportReport
Posted on by 12

I think this will require multiple JSON expressions and Y/N conditions (for null) to allow for the flexibility of all the files I may need uploaded. I just am unfamiliar with how to build it. 

 

Here is the general flow I am trying to achieve:

1. User submits an MS Form that has five sections and "branching" built-in to guide the user through the submission. Here is a snip of the beginning of the Form (total of 128x Questions, 8x of which allow the user to upload multiple files that are required depending on their responses.

pbj2011_4-1704018303112.png

 

2. The user might be required to upload multiple documents across 1-5x different questions, depending on their inputs. 

3. I want these attachments to automate into a SharePoint List and simultaneously attached to an automated email.

 

I have been successful in getting up to 2x files uploaded into the SharePoint list and 1x file uploaded as an attachment in an email.

 

Here is the Problem I am trying to solve:

1) I am unclear how to build the flow to have more than 2x files across multiple MS Form questions and account for "null" answers. Here is the flow from MS Forms to my SharePoint List. 

 

pbj2011_0-1704017998663.png

pbj2011_1-1704018044643.png

2) I am unclear how to build the email flow to have more than 1x file attached from the MS Form submission. Here is my flow from MS Forms to Email.

pbj2011_2-1704018154289.png

pbj2011_3-1704018178955.png

 

  • Codatron Profile Picture
    7 on at
    Re: Multiple file uploads from 1-8x different MS Form questions, including "null" uploads

    Thanks @creativeopinion 

    Not surprisingly - in the act of typing out my problem as a new questions I saw my error in the union code and solved my issue!

  • creativeopinion Profile Picture
    10,439 Super User 2025 Season 1 on at
    Re: Multiple file uploads from 1-8x different MS Form questions, including "null" uploads

    @Codatron It would be helpful to see a screenshot of your full flow. The union() function only accepts two parameters. It can only combine one array with another. 

     

    I'd also recommend starting a new post since this one has already been marked as solved.

  • Codatron Profile Picture
    7 on at
    Re: Multiple file uploads from 1-8x different MS Form questions, including "null" uploads

    Apologies for the hijack, but keen to tease out a similar problem. I have the same workflow effectively, except I am working with 13 file arrays. I understand that union can only combine 10 maximum parameters. 

    So, how can i combine all 13 into a single array to attach to my email?

    Value your input!

  • Verified answer
    creativeopinion Profile Picture
    10,439 Super User 2025 Season 1 on at
    Re: Multiple file uploads from 1-8x different MS Form questions, including "null" uploads

    @pbj2011 As suggested in my original post you should be testing your flow at each stage and troubleshoot at each stage before trying to build the full flow and troubleshoot later.

     

    Troubleshoot File Not Found

    If you copy the File Path from the failed Get file content using path action and paste it into your browser. Does the file come up? If it does, it means that you might need to either add a delay before this action to ensure the file is fully uploaded before you try to run it—you could also add a delay at the start of the flow to ensure all files are uploaded before the rest of the actions in your flow run.

     

    Alternatively you could add a Do Until loop. 

    creativeopinion_7-1704138511435.png

     

    You can also manually check your Document library to see if the file is there as well.

    creativeopinion_8-1704138607999.png

     

     

    Condition Check

    You've set up the condition check incorrectly. The value entered into the second value field should be zero not null. 

     

    In this particular flow run I purposely didn't upload any files. The output of the Compose action is zero

    creativeopinion_4-1704137368794.png

    When the condition check is run and the value in the second field is zero, it'll return false. This means there aren't any items returned.

     

    creativeopinion_3-1704137338444.png

    creativeopinion_0-1704137284849.png

     

    However, if you insert the second value as null, it'll return true—which is "correct" but not the result you want. If there are zero files returned—you want the result to be false so that nothing happens. Or, if you do want actions to be taken if the result is false you need to add additional conditions to the NO branch.

    creativeopinion_2-1704137325458.png

     

    creativeopinion_1-1704137316589.png

     

    Variable JSON

    The reason your attachments aren't being collected is that the JSON is formatted incorrectly. The JSON is case sensitive.

     

    Name must have a capital N. ContentBytes must have a capital C and B. 

    creativeopinion_5-1704137614096.png

     

    Hope this helps!

    If I helped you solve your problem—please mark my post as a solution .
    Consider giving me a 👍 if you liked my response!

    👉Watch my tutorials on YouTube
    👉Tips and Tricks on TikTok
    For more flow troubleshooting tips—check out This YT Tutorial: 5 Power Automate Troubleshooting FAQs and Helpful Tips for Creating Better Flows
     
    In this tutorial I cover:
     How to troubleshoot a false Condition action result
     How to get dynamic content when it isn’t selectable from the list of dynamic content
     How to troubleshoot an Apply to Each action that isn’t looping through
     How to troubleshoot a skipped Apply to Each action
     How to troubleshoot a Filter Query
     How to use a SharePoint yes/no column in a Filter Query
     How to use Compose actions to troubleshoot a Power Automate flow
    How to troubleshoot multiple emails being sent
     How to troubleshoot multiple Teams messages being sent
  • pbj2011 Profile Picture
    12 on at
    Re: Multiple file uploads from 1-8x different MS Form questions, including "null" uploads

    I ran this entire flow. Here are the things that are not working with specifics below:

    1. unable to find one of the three documents I attached in the MS Form.

    2. did not attach the form to the email.

    3. if a submission is received with no attachments, no email is sent.

    Here is an overview of my flow and the error message I received:

     

    ISSUE #1: unable to find one of the three documents I attached in the MS Form.

    Error Message: "File not found clientRequestId: 0be37820-564f-41ac-919f-060a6d1af78f service RequestId: 0be37820-564f-41ac-919f-060a6d1af78f

    pbj2011_9-1704117194280.png

     

    Below is the precise structure of my flow

    pbj2011_5-1704116725154.png

     

    Condition

    Section 1 = 'Compose_-_Count_of_Files'

    pbj2011_2-1704116498814.png

    Apply to Each

    Outputs = 'Compose_-_Combine_Uploaded_Files'

    pbj2011_3-1704116522919.png

    Get file content using path

    File Path ='item()?['link']'

    pbj2011_4-1704116636223.png

    Compose - Attachment Name

    Inputs = 'item()?['name']'

    pbj2011_6-1704116795159.png

     

    Add Attachment

    File Name = "Compose_-_Attachment_Name'

    pbj2011_8-1704116846933.png

    I uploaded 3x files into this submission, only two attached successfully to the SP List. This meant that 5x files were "null" value. It seams like the flow ran correctly, but failed to find that 3rd attachment. 

    pbj2011_0-1704115936717.png

    All other content was input into SP correctly without any issues. It was just that one attachment that I think failed to upload. But I could be wrong, still learning how to read PA. 

     

    ISSUE #2. did not attach the form to the email.

    pbj2011_14-1704121394681.png

     

    pbj2011_12-1704121245554.png

     

    pbj2011_10-1704121144165.png

     

    ISSUE #3. if a submission is received with no attachments, no email is sent.

    I think this is a relatively easy fix. There are some instances where there will not zero attachments in a form submission. I think this means that I just need to mirror the "If yes" actions under the "If no" portion...unless this will send duplicate emails?

    pbj2011_15-1704121444821.png

     

  • pbj2011 Profile Picture
    12 on at
    Re: Multiple file uploads from 1-8x different MS Form questions, including "null" uploads

    wow, extremely detailed. I'll build it out and let you know if I am able to get it to work, thanks!

  • creativeopinion Profile Picture
    10,439 Super User 2025 Season 1 on at
    Re: Multiple file uploads from 1-8x different MS Form questions, including "null" uploads

    @pbj2011 The logic of your flow needs a little adjusting. What you'll need to do is the following:

    • Get the Form Response details
    • Collect all file uploads into a collection
    • Create a SP Item
    • Check to see if any files have been uploaded – If a user must upload at least one file you can omit this step
    • Loop through all uploaded files
    • Add attachments to the SP Item
    • Collect attachments into an array variable
    • Send an email

    creativeopinion_46-1704089109951.png

     


    I'm only going to cover how to get the file uploads from your MS Form into SharePoint and attached to an email. If you need additional help on formatting your email or MS form responses— refer to this YT Tutorial I recently uploaded: How to Get a Microsoft Form RSVP Response into a SharePoint List

    I cover the following in this video tutorial:

    How to get a Microsoft Form Response into SharePoint

    How to get a Microsoft Form ID

    How to get a Microsoft Form response

    How to Build a Microsoft Form with Conditional Fields

    How to used Branching in Microsoft Forms

    How to format Microsoft Form multiple choice responses for a SharePoint multi-choice column

    How to parse a Microsoft Form multiple choice response as string of text

    How to convert a text response to a number

    How to use the Switch action

    How to create a custom email confirmation for a Microsoft Form submission

    How to Create a Custom View in a SharePoint list

    How to use the Compose Action

    How to write Power Automate Expressions

     

    Manual Trigger

    In the tutorial I cover how to use a manual trigger so that you don't need to submit a form each time to trigger your flow. Please reference this section of the tutorial on how to do this. 

     

    creativeopinion_1-1704071478868.png

     

    Compose File Uploads

    I'm using a Scope action to group the next few actions in the flow. Scope actions are great because they help keep my flow organized. I can also quickly collapse multiple actions with a single click. The Scope action is optional.

     

    Add a Compose action for each File Upload field in your form. For my demo I have 3 file upload fields.

    creativeopinion_5-1704086175287.png

     

    Insert the json() expression. This function will convert the file upload details into a readable format—a JSON array.

    creativeopinion_2-1704086091333.png

    Click on the Dynamic content tab and insert the appropriate MS Form output. 

    creativeopinion_3-1704086124744.png

    Repeat this step for each of the file upload fields in your form. Tip: Remember to rename your actions to keep your flow organized.

    creativeopinion_4-1704086163787.png

     

    Combine File Uploads

    Next you'll need to combine the file upload JSON arrays into a single array. Add a Compose action. I've nested mine inside another Scope action (the Scope action is optional).

    creativeopinion_6-1704086503251.png

     

    To combine arrays into a single array. You'll need an expression. First you'll need an expression to check if the array is empty. If it is, you'll need to output an empty array instead of a null value. You'll be using the union() function to combine the arrays and this function requires arrays. If you try to pass a null value you'll get an error.

     

    To check if the array is empty, we'll need to use the empty() function. 

    creativeopinion_8-1704086822122.png

    Click on the Dynamic content tab and insert the output from the Compose action that is storing the response from the first file upload field. Note: This is why it's important to rename your actions. Otherwise things can get confusing really fast.

     

    creativeopinion_7-1704086741889.png

     

    Next, we'll need to use the if() function.The if() function takes three parameters. The first parameter is a condition that returns a boolan value (aka true or false), the second parameter is the value that is returned if the condition is true. The last parameter is the value returned if the condition is false.

     

    Go to the start of the expression by pressing the up arrow key and type in if with an opening parenthesis. Keep an eye out for the expression tooltip. It'll bold the text of the parameter you are currently setting. 

    creativeopinion_9-1704086931967.png

    Go to the end of the expression by pressing the down arrow key and enter a comma and insert:

     json('[]')

    creativeopinion_10-1704087130073.png

     

    This is the true value. In other words, if your array from the first file upload field is empty, it'll output an empty json array. 

     

    Add another comma and insert the output from the first file upload field again.

    creativeopinion_11-1704087156649.png

    Add a closing parenthesis.

    creativeopinion_12-1704087188566.png

     

    Your expression should look like this:

    if(empty(outputs('Compose_-_Upload_Files_1')),json('[]'),outputs('Compose_-_Upload_Files_1'))

    Keep in mind, if you've named your Compose actions differently than what i have in my flow, your expression will look slightly different.

     

    Run a test. If your first file upload field does contain file uploads, you should see the details of those files in the outputs. 

    creativeopinion_13-1704087288712.png

    If your field doesn't contain any file uploads the Compose action will look like this:

    creativeopinion_14-1704087367939.png

    If you click on the Click to download link—you'll see an empty array. This is what you want.

    creativeopinion_15-1704087388714.png

     

    Because you have many file upload fields. It'll be a lot easier to compose your expression in a text editor. The expression editor in Power Automate makes it really hard to see the full expression.

     

    Click on the expression label to open it up in the Expression field.

    creativeopinion_16-1704087485247.png

    Copy the entire expression to your clipboard.

    creativeopinion_18-1704087543799.png

     

    Paste it into a text editor. Add a comma at the end of the line.

    creativeopinion_19-1704087570386.png

     

    Paste in as many lines as you need, ensuring that you add a comma after each line (except for the last line). In my case, I only have three file upload fields. You'll need to adjust the numbers for each line—this will only work if your Compose actions have the same syntax.

    creativeopinion_20-1704087640980.png

    creativeopinion_21-1704087683490.png

    Next, wrap the entire expression in the union() function. The union() function will combine two or more arrays or collections into one and remove any duplicates in the process. In your scenario you don't need to worry about any duplicates as you are really using this function just to combine the arrays.

    creativeopinion_22-1704087734575.png

    Copy this entire expression to your clipboard. Replace the existing expression with your new expression.

     

    creativeopinion_24-1704087947765.png

    Return the File Count

    Use an expression to return the count of items from the Compose action above. This is can be helpful to troubleshoot.

    Insert a Compose action. Add an Expression. Use the length() function.

    creativeopinion_26-1704088066717.png

     

    Select the Dynamic content tab and insert the value dynamic content from the Get Items action into the length() function.

    creativeopinion_27-1704088084529.png

    Run a test. Confirm the number in the Compose action output. 

    creativeopinion_28-1704088129746.png

     

    Create Item

    Add a Create Item action and insert any dynamic content where necessary.

    creativeopinion_29-1704088190187.png

     

    Initialize Array Variable

    Add an initialize variable action to your flow. Select Array as the type.

    creativeopinion_30-1704088216558.png

    Condition Check

    Add a Condition action to your flow. In the first value field, insert the output from the Compose action that is storing the count of files.

    creativeopinion_33-1704088357257.png

    Change the operator to is not equal to and enter zero into the second value field.

    creativeopinion_32-1704088316893.png

     

    In the YES branch add the rest of your actions.

     

    Loop through Each Attachment

    Add an Apply to Each action into the YES branch. Insert the output from the Compose action with the array of files.

    creativeopinion_34-1704088441833.png

     

    Get File Content

    Add a Get file content using path action. You'll need this action to get each attachment's file content so that you can attach it the file to a SP item as well as an email.

    creativeopinion_38-1704088886474.png

     

     

    In the File Path field, you'll need to use an expression to access the file path.

    If you take a look at the output of the Compose action that combines the file arrays, you'll see the dynamic content. The expression we'll be using is the item() function. To access the dynamic content you'll need the dynamic content key. The dynamic content key is the text in red between the double quotes.

    creativeopinion_35-1704088525445.png

    In this case, it's link.

     

    Insert an expression:

    item()?['link']

    creativeopinion_36-1704088559175.png

    Because you'll need the attachment name in the next couple actions, I'd recommend using a Compose action to store it. You'll use the same expression as above, you just need to adjust the dynamic content key from link to name.

    creativeopinion_37-1704088770420.png

    Add Attachment to SP Item

    Add an Add attachment action to your flow. Ensure it's nested inside the Apply to Each action.

    creativeopinion_43-1704089011793.png

     

    For the ID, you'll need to insert the ID from the Create Item action. 

    creativeopinion_40-1704088948389.png

    For the File Name, you can insert the output from the Compose action above.

    creativeopinion_42-1704088979845.png

    For the File Content, insert the File Content dynamic content from the Get file content using path action. 

    creativeopinion_44-1704089019406.png

     

    Run a test. Check to see if your SP item has been created with attachments.

    creativeopinion_47-1704089176766.png

     

    Append to Array Variable 

    Add an Append to Array Variable action. Insert the following JSON.

    {
    "Name": [Insert Compose Action Output],
    "ContentBytes": [Insert File Content]
    }

    creativeopinion_49-1704089287632.png

     

    Send an Email

    Add a Send an Email (V2) action outside of the Apply to each action.

    creativeopinion_50-1704089326158.png

    Click on Show advanced options. Click on the icon to switch to input entire array. 

    creativeopinion_51-1704089368423.png

    Insert the variable into the Attachments field.

    creativeopinion_52-1704089409435.png

    Run a test. Ensure that the email has all of your attachments.

    creativeopinion_53-1704089429218.png

    Hope this helps!


    If I helped you solve your problem—please mark my post as a solution .
    Consider giving me a 👍 if you liked my response!

    👉 Watch my tutorials on YouTube
    👉 Tips and Tricks on TikTok

    If you are looking for a way to send multiple SharePoint List items that have been assigned to a user in an email—check out this YT Tutorial: How to Send a SINGLE EMAIL ✉️ with multiple SharePoint list items | Build THIS Power Automate Flow

    In this tutorial I cover:

     How to send multiple list items in a single email with a Power Automate Flow

     How to create a dynamic date range

     How to use the Convert Time Zone action

     How to use a Filter Query in the Get Items action

    How to count number of items in an array

     How to use the Select action to extract a users display name and email address

     How to create a unique list of email addresses

     How to use the Create HTML Table action

     How to customize the HTML Table with CSS styles

    How to use the Send an email (V2) action

    How to use the Append to String Variable action

    How to create a custom list of items for an email

    How to use the Send an email (V2) action

    How to display singular or plural text based on the number of items returned

     

     

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

Michael Gernaey – Community Spotlight

We are honored to recognize Michael Gernaey as our June 2025 Community…

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 566 Super User 2025 Season 1

#2
David_MA Profile Picture

David_MA 516 Super User 2025 Season 1

#3
stampcoin Profile Picture

stampcoin 492