Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Automate - Building Flows
Answered

Update Flow to Upload Attachment to Specific Nest Folder in Library

(0) ShareShare
ReportReport
Posted on by 4,941 Super User 2025 Season 1

Need:
I have the need to dynamically decide to which Folder/Subfolder in a Library an attachment is uploaded.

Background:
I have a Flow that creates a Folder and Nested Folders whenever a new item is created in a SharePoint List.

This function works fine.

I, also, have a Flow that is uploading attachments to a specific Subfolder. That function works fine.

I would like the ability to upload the attachment to a specific Subfolder assoicated with the name of the individual, as chosen in the Gallery. All attachments should be routed to the Root folder associated with the name of the client, and uploaded to the Subfolder associated with the 'type' of document being uploaded.

Components: 
My 'Upload Attachments' button has the following formula -
UploadClientAttachmentsFlow.Run(Upload_Client_ID_Fld.Text,Label15.Text,TextInput1_3.Text,
{ file: {
          contentBytes: First(Client_Attachments_Control_2.Attachments).Value,
                      name: First(Client_Attachments_Control_2.Attachments).Name
         }
});

The user has the ability to choose, from a Dropdown box, the type of attachment being uploaded. That choice is also used in the naming of the file when it is uploaded to the Library.

Example:
If the user wants to upload a 'Drivers License' (as chosen in the Gallery), related document associated with client 'Olive Oil' (as chosen in the Gallery), the Flow should route the document to the Root folder for 'Olive Oil' and add it to her 'Drivers License' subfolder.

My Power Apps Attachment Upload Gallery -

Phineas_0-1698601097872.png


My 'Upload Attacments' Flow -

Phineas_1-1698602500665.png


My preferred upload folder/subfolders -

Phineas_2-1698602646282.png

Phineas_3-1698602690982.png

 

  • Phineas Profile Picture
    4,941 Super User 2025 Season 1 on at
    Re: Update Flow to Upload Attachment to Specific Nest Folder in Library

    I created another Dropdown in the Power Apps Gallery called 'Folder Name' that has the names of all the sub-folders.

     

    I've had issue with adding things to my flow and the flow formula in Power Apps.

     

    Can you advise, based on the images I have provided, how to update the Flow trigger, Flow create folder, and Power App button formula?

     

     

  • Verified answer
    ManishSolanki Profile Picture
    15,085 Super User 2025 Season 1 on at
    Re: Update Flow to Upload Attachment to Specific Nest Folder in Library

    Hi @Phineas 

     

    I would suggest passing ClientName from the drop down to the power automate as another input parameter. You need to find the logic to get the document type folder name from the document name input parameter (may be lookup from excel or SharePoint site). Using these 2 input parameters, you could set the folder path dynamically in create file action as mentioned in my previous reply.

     

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

     

    Thanks

     

     

  • Phineas Profile Picture
    4,941 Super User 2025 Season 1 on at
    Re: Update Flow to Upload Attachment to Specific Nest Folder in Library

    I'm passing those fields already in the Power Apps (V2).

    How would the 'Folder Path' formula look based on the below?

    Phineas_0-1698683297917.png

     

  • ManishSolanki Profile Picture
    15,085 Super User 2025 Season 1 on at
    Re: Update Flow to Upload Attachment to Specific Nest Folder in Library

    Hi @Phineas 

     

    You need set the "Folder Path" dynamically in Create file action. Here is an example:

    ManishSolanki_1-1698636059568.png

    Using expression, I have set the folder path dynamically:

    concat('/Shared Documents/',triggerBody()['text'],'-',triggerBody()['text_1'],'/',triggerBody()['text_2'])

    Similarly, pls set the folder path dynamically as:

    concat('/<<SharePoint document library name>>/',<<ClientID Input variable>>,'-',<<ClientName input variable>>,'/',<<DocumentType input variable>>)

    Note: You need to pass the input parameters from canvas app: client Id, client name, document type folder name etc.

     

    Pls modify the flow & retest it.

     

    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

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