top of page
  • Ajith Madathil

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)



5,704 views0 comments

Recent Posts

See All

The Compose action

Microsoft Power Automate (aka Microsoft Flow) provides lots of action steps out of the box. My favourite one is Compose. What does it do? What is the Compose action? The Compose action is like a stati

How to call an API using the Power Automate HTTP action

In this blog post I will access NASA's Astronomy Picture of the Day (APOD) API using Power Automate. The plan is to retrieve the picture of the day using the API and store it in a SharePoint document

Blog Categories
 

Beginner

Intermediate

 

Advanced

Power Automate Essentials

How can I help you?

I am happy to help at any time.  You can contact me via the official PowerAutomate community forum.  Tag me (@abm) on any post you make there if you would like to me take a look at it.

I am always available for both corporate training or 1-2-1 training for individuals. 

bottom of page