Skip to main content

Notifications

Power Automate - Building Flows
Suggested answer

SharePoint getting folder contents and sending them elsewhere eluding me

Posted on by 2
Hello all,
 
I am so grateful for all of you in the community, I think of myself as a decently advanced user of Power Automate, largely due to a lot of things I have read here. But I have a project that is eluding me. Broad details I have somebody that is responsible for uploading data into folders in my SharePoint but the folders are dynamic, so there would be files in a folder for a date 11-4, 11-5, 11-6, etc and each folder would have several files in them. I need a power flow that gets the files from the folder when the folder is created, and then send them somewhere else, in this case it is going to use the SFTP-SSH connection, but that part is relatively irrelevant.
 
The issue I am having is I cannot think of a trigger that would allow for a dynamic folder path, particularly because they aren't the main folders in the library (For example it goes Documents/Client/Facility/Date/ then get the files from said folder to perform the next action.
 
Thank you for any help you can provide!
  • MV-04112139-0 Profile Picture
    MV-04112139-0 2 on at
    SharePoint getting folder contents and sending them elsewhere eluding me
    Thank you for the response! I got the trigger working, how would I get the files within that folder. I was thinking a "For each" but I can't seem to drill into that folder despite doing something like this. It sees the folder, but I cannot seem to get the files out of us.


  • Suggested answer
    EKarim Profile Picture
    EKarim 10,261 on at
    SharePoint getting folder contents and sending them elsewhere eluding me
    Here's something you can try:
     
    1. Start with the trigger When a file is created (properties only) as shown:
     
     
    2. Add two trigger conditions.
    • One trigger condition to only trigger the flow if a folder was created
    • Another condition to trigger the flow if folder path starts with 'Shared Documents/Client/Facility/'


    @triggerOutputs()?['body/{IsFolder}']
    @startsWith(triggerOutputs()?['body/{FullPath}'],'Shared Documents/Client/Facility/')
    Note that in the @startsWith() you must use to the correct name of 'Shared Documents'

    You would need to wait to ensure that all the data files have been written to the folder before sending them using SFTP-SSH.

    Finally, you could add another trigger condition to check if the folder that was just created was created ONLY under 'Shared Documents/Client/Facility/' (i.e. at a folder depth of 4) and not for example 'Shared Documents/Client/Facility/11-04/Folder1'.

    @equals(length(split(triggerOutputs()?['body/{FullPath}'],'/')),4)






    The data (properties) in the Body of the triggerOutputs that we are interested in will look something like this:

    "{IsFolder}": true
    "{FullPath}": "Shared Documents/Client/Facility/11-4"


    Ellis
     

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

November 2024 Newsletter…

November 2024 Community Newsletter…

Community Update Oct 28…

Power Platform Community Update…

Tuesday Tip #7 Community Profile Tips…

Welcome to a brand new series, Tuesday Tips…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 143,487

#2
RandyHayes Profile Picture

RandyHayes 76,308

#3
Pstork1 Profile Picture

Pstork1 64,014

Leaderboard