cancel
Showing results for 
Search instead for 
Did you mean: 
abm
Most Valuable Professional

How to find a folder exists (Dynamic) in SharePoint?

This is something I noticed from community often discussed about SharePoint List Folder can’t have dynamic folder mapping. In this blog I will show you how can we use dynamic folder mappings using SharePoint List Folder action. Action step List Folder file identifier represents the path of a valid SharePoint folder name. If folder not found generally flow will fail and stop the execution. Follow below steps how to determine whether the folder exists or not and continue the flow execution.

I have a SharePoint document library called ‘aj’. Here I have couple of folders called Test1, Test2 & Test3.

 

image.png

 

The flow we are going to build is pass the dynamic folder mappings, find whether a folder exists in SharePoint or not. If folder exists, then get the file contents.  

First step is the trigger and here I am using a manual trigger.

image.png

 

Next step is initialising two variables. One is used for identifying whether a folder exists or not (Boolean) and other is a string where we pass the folder name.

image.png

 

Above I have hardcoded the folder name (SharePoint library name/Folder name).

Next, we need to use the SharePoint List Folder action. Here I am using folder name variable under the file identifier setting as dynamic content. If required, you can also use the SharePoint URL mapping via variable.

image.png

 

Above step set the configure run after as follows:

image.png

image.png

 

Once it set click done.

Next step we need to add a parallel branch.

image.png

 

Here we need to add two steps under the parallel branch.

 

(a) First variable sets the IsFolderExists to true.

image.png

 

Also set the configure run (Select the three dot of Set variable True) after as follows:

image.png

 

(b) Second variable (parallel branch action) is as follows:

image.png

 

Set the configure run after as follows:

image.png

 

Finally, we have two parallel actions like below.

image.png

 

Next step is to check the condition whether SharePoint folder found or not?

image.png

 

For the above step set the configure run after as follows:

Remember to set all true except ‘has timed out’ for both set variable True or False. Select using the mouse for each Set variable (True/False) and select the options separately.

image.png

 

Once both variables are set then click done.

Final step is  to get the name of the files from the folder under the Yes condition.

image.png

 

Here are my run results:

  • A valid SharePoint folder exists Folder name = /aj/Test1

image.png

 

  • Folder does not exist. Folder name = /aj/Test999

image.png

 

Thank you for reading.

Comments
About the Author
  • Experienced Consultant with a demonstrated history of working in the information technology and services industry. Skilled in Office 365, Azure, SharePoint Online, PowerShell, Nintex, K2, SharePoint Designer workflow automation, PowerApps, Microsoft Flow, PowerShell, Active Directory, Operating Systems, Networking, and JavaScript. Strong consulting professional with a Bachelor of Engineering (B.E.) focused in Information Technology from Mumbai University.
  • I am a Microsoft Business Applications MVP and a Senior Manager at EY. I am a technology enthusiast and problem solver. I work/speak/blog/Vlog on Microsoft technology, including Office 365, Power Apps, Power Automate, SharePoint, and Teams Etc. I am helping global clients on Power Platform adoption and empowering them with Power Platform possibilities, capabilities, and easiness. I am a leader of the Houston Power Platform User Group and Power Automate community superuser. I love traveling , exploring new places, and meeting people from different cultures.
  • Read more about me and my achievements at: https://ganeshsanapblogs.wordpress.com/about MCT | SharePoint, Microsoft 365 and Power Platform Consultant | Contributor on SharePoint StackExchange, MSFT Techcommunity
  • Encodian Owner / Founder - Ex Microsoft Consulting Services - Architect / Developer - 20 years in SharePoint - PowerPlatform Fan
  • Founder of SKILLFUL SARDINE, a company focused on productivity and the Power Platform. You can find me on LinkedIn: https://linkedin.com/in/manueltgomes and twitter http://twitter.com/manueltgomes. I also write at https://www.manueltgomes.com, so if you want some Power Automate, SharePoint or Power Apps content I'm your guy 🙂
  • I am the Owner/Principal Architect at Don't Pa..Panic Consulting. I've been working in the information technology industry for over 30 years, and have played key roles in several enterprise SharePoint architectural design review, Intranet deployment, application development, and migration projects. I've been a Microsoft Most Valuable Professional (MVP) 15 consecutive years and am also a Microsoft Certified SharePoint Masters (MCSM) since 2013.
  • Big fan of Power Platform technologies and implemented many solutions.
  • Passionate #Programmer #SharePoint #SPFx #M365 #Power Platform| Microsoft MVP | SharePoint StackOverflow, Github, PnP contributor
  • Web site – https://kamdaryash.wordpress.com Youtube channel - https://www.youtube.com/channel/UCM149rFkLNgerSvgDVeYTZQ/