How to check whether a folder exists in SharePoint (using Power Automate)
Updated: Apr 1, 2020
I have a SharePoint document library called aj, and inside of it, three folders (Test1, Test2 & Test3).
I am going to build a flow to check whether a folder exists in aj. If the folder exists, then I will grab the file contents.
My first action in the flow is a manual trigger.
The next step is to initialise two variables. One variable is a boolean used for storing whether a folder exists, and the other is a string that stores the folder name and path that we want to find - in this example /aj/Test1.
Next, we need to use the SharePoint List Folder action. Here I am using the FolderName variable from the previous step under the file identifier setting as dynamic content. If required, you can also use the SharePoint URL mapping via a variable.
For the above set the Configure run after property as follows:
Now we add a parallel branch.
Here we need to add two steps under the parallel branch.
Step #1 - Create a variable called IsFolderExists. We set it to true.
Set the Configure run after (Select the three dot of Set variable True) after as follows:
Step #2 - Create another variable called IsFolderExists! We set it to false this time.
Set the Configure run after as follows:
Now we should have two parallel actions as shown:
The next step is to check the condition of whether the SharePoint folder is found or not
For this we set the Configure run after as follows:
For both set variables (True and False) make sure you set all the checkboxes to true except for ‘has timed out’.
Once both variables are set then click done.
The final step is to get the name of the files from the folder under the Yes condition.
And now if we run it.....
Here are my run results:
If the SharePoint folder exists (Folder name = /aj/Test1)
If the folder does not exist Folder does not exist (Folder name = /aj/Test999)