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 -
My 'Upload Attacments' Flow -
My preferred upload folder/subfolders -
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?
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
I'm passing those fields already in the Power Apps (V2).
How would the 'Folder Path' formula look based on the below?
Hi @Phineas
You need set the "Folder Path" dynamically in Create file action. Here is an example:
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
Michael E. Gernaey
566
Super User 2025 Season 1
David_MA
516
Super User 2025 Season 1
stampcoin
492