Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Automate - Building Flows
Unanswered

Need Help with PowerApps to Power Automate Flow for Single Folder Creation with Multiple File Uploads

(0) ShareShare
ReportReport
Posted on by

Hi all,

 

I'm working on an app in PowerApps that requires file management with SharePoint through Power Automate. The process I have in place involves a user attaching multiple files within PowerApps, which then triggers a flow to upload these files to SharePoint.

Here's where I'm encountering a challenge:

- The original flow was designed to create a new folder in SharePoint for each file uploaded. This resulted in multiple folders being created when multiple files were attached - one folder per file, which isn't what I need.
- To address this, I created a separate flow that runs first to create a single new folder in SharePoint. This flow then uses the 'Respond to a PowerApp or flow' action to send back the folder path (named 'foldername') to PowerApps.

2023-12-28_11h47_19.png
- With this setup, I'm unsure about the additional input I need to include in the PowerApps trigger for the file upload flow. Moreover, I'm looking for guidance on what the expression for 'Folder Path' in the 'Create file' action within the flow should be to ensure all files are uploaded to the newly created single folder.

MKData95_0-1703761429626.png

Could anyone offer insight into how I should structure the PowerApps trigger input and the 'Create file' folder path expression in Power Automate to achieve this functionality?

 

Any examples or pointers would be greatly appreciated!

 

Below is the OnSelect of the button is PowerApps if that's helpful:

 

// Step 1: Run 'Create_new_folder' flow and store folder path
Clear(collFolderPath);
Collect(collFolderPath, Create_new_folder.Run());
Set(folderPath, First(collFolderPath).foldername);

// Step 2: Check if folder creation is successful
If(
 IsBlank(folderPath),
 Notify("Error in creating folder", NotificationType.Error),

 // Step 3: If folder created successfully, upload files to folder
 Clear(collResult);
 ForAll(
 'DataCardValue22_1'.Attachments As file,
 Collect(
 collResult,
 'Upload_file_to_sharepoint'.Run({
 contentBytes: file.Value,
 name: file.Name,
 folderPath: folderPath // Passing the folder path to the flow
 }).response
 )
 );

 // Step 4: Check for errors in file upload
 If(
 LookUp(collResult, Value = "Error Occured").Value,
 Notify("Error Occurred in file upload", NotificationType.Error),
 Notify("Attachments uploaded successfully", NotificationType.Success)
 )
);

 

 

Thank you in advance for your help!

  • ManishSolanki Profile Picture
    15,085 Super User 2025 Season 1 on at
    Re: Need Help with PowerApps to Power Automate Flow for Single Folder Creation with Multiple File Uploads

    Hi @MKData95 

     

    As you modified the flow by adding a new parameter "folderpath" so you need to update or refresh the same from the app.

     

    To resolve the error, select "Power Automate" from left navigation menu then locate the flow. Click (...) and press 'Refresh' option:

    ManishSolanki_0-1703839348388.png

     

     

    If this helps & solves your problem, please remember to give a 👍 and accept my solution as it will help others in the future.

     

    Thanks

  • MK-04030856-0 Profile Picture
    on at
    Re: Need Help with PowerApps to Power Automate Flow for Single Folder Creation with Multiple File Uploads

    Hey @ManishSolanki,

     

    Thanks for your help!

    I adjusted all parameters according to your reply. Now i get an error on:

     

     ForAll(
     'DataCardValue22_1'.Attachments As file,
     Collect(
     collResult,
     'Upload_file_to_sharepoint'.Run({
     contentBytes: file.Value,
     name: file.Name
     },
     folderPath // Passing the folder path to the flow
     ).response
     )
     ); 

     

    The error states: 'Invalid number of arguments: received 2, expected 1'. Would i have to add another string input variable for the filename? Below is the current expression for the filename:

    MKData95_0-1703836652570.png

     

    Thanks again

  • ManishSolanki Profile Picture
    15,085 Super User 2025 Season 1 on at
    Re: Need Help with PowerApps to Power Automate Flow for Single Folder Creation with Multiple File Uploads

    Hi @MKData95 

     

    Pls make the following changes to resolve the issue:

     

    In first flow, return the full path of the newly created folder instead of variable value as shown below:

    ManishSolanki_0-1703764824968.png

     

    Next, replace 3 lines of code with one statement in "On Select" method of the app:

    // Step 1: Run 'Create_new_folder' flow and store folder path
    Clear(collFolderPath);
    Collect(collFolderPath, Create_new_folder.Run());
    Set(folderPath, First(collFolderPath).foldername);
    Set(folderPath, Create_new_folder.Run().foldername);

     

    Finally, in create file flow. Add another string input variables that holds the path of the folder. Pass the folder path input variable in 'Folder Path' parameter of "Create file" action as shown below:

    ManishSolanki_1-1703765312863.pngManishSolanki_2-1703765367760.png

     

    You need to change the code in power apps to run this flow:

    ForAll(
    'DataCardValue22_1'.Attachments As file,
    Collect(
    collResult,
    'Upload_file_to_sharepoint'.Run({
    contentBytes: file.Value,
    name: file.Name
    },
    folderPath // Passing the folder path to the flow
    ).response
    )
    );

     

    Pls retest the flow after making the changes.

     

    If this helps & solves your problem, please remember to give a 👍 and accept my solution as it will help others in the future.

     

    Thanks

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

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June 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 497 Super User 2025 Season 1

#2
David_MA Profile Picture

David_MA 436 Super User 2025 Season 1

#3
Riyaz_riz11 Profile Picture

Riyaz_riz11 244 Super User 2025 Season 1