Requirement:
In my Power Automate flow (Instant Flow), when a user selects a file from a subfolder within a SharePoint "Documents" library, I want to retrieve all the files within the same folder as the selected file. This will allow me to iterate over all the files in that folder and perform certain actions (like processing or manipulating the files).
Folder structure example:
- /SharedDocuments/Folder1/Subfolder1/image1.jpg
- /SharedDocuments/Folder1/Subfolder1/image2.jpg
So, when a user selects a file (e.g., image1.jpg), I need to fetch all the files in /SharedDocuments/Folder1/Subfolder1/, which in this case would be image1.jpg and image2.jpg.
Struggle:
I’ve been using the "Get Files (Properties only)" action, which requires specifying a library name, but the challenge is that my target folder is a subfolder within the "Documents" library, not directly in the root.
The issue I’m facing is that the "Get Files (Properties only)" action doesn’t allow me to directly specify a subfolder without defining the full path. I can only specify the library, but not the specific subfolder path dynamically based on the selected file’s folder.
As a result, while I can retrieve the properties of the selected file, I’m struggling to figure out how to dynamically get all the files from the same folder as the selected file, iterate over them, and perform actions on each of them.