web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Create Sharepoint fold...
Power Apps
Unanswered

Create Sharepoint folder if it does not exist, else add file to existing folder

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

I'm very new to Powerapps and have gotten a bit stuck. I have a Sharepoint Library which follows the structure: SITENAME/PROJECTS/<ClientRef>/<ProjectRef>

 

The ClientRef and ProjectRef folders are dynamically added from PowerApps when a new client and project is registered. The issue I have is that any photos, drawings or notes taken after registration then need to be uploaded to the relevant client's SP folder. Ultimately, each client will have a ClientRef folder, followed by a ProjectRef then 3 subfolders (drawings, photos, notes). These folders are where the files created in Powerapps will be stored. 

 

At present, my MS Flow fails because it cannot find the 'drawings', 'notes', 'photos' folders. I'm sure it's very simple but I can't seem to work out how to insert something into my flow which basically does the following:

 

- check if a subfolder named 'drawings' exists within the relevant client's structure

- if it does, then upload the file here

- if it doesn't exist, then create the folder and upload the file afterwards

 

This is the formula within Powerapps itself...

UploadDrawing.Run(Concatenate(ClientRef,"_",ProjectRef,"_Drawing"),JSON(ThisItem.Url,JSONFormat.IgnoreBinaryData),Concatenate(ClientRef,"/",ProjectRef,"/drawings"))

 

The flow creates a filename using the variables, sets the content then specifies the path. 

 

Any help would be greatly appreciated!

Categories:
  • Brayden Larson Profile Picture
    Microsoft Employee on at

    Hello,

     

    The connections used for Sharepoint to grab folder's does not directly detect if there is a subfolder inside of the folder, instead you would need to setup the action to navigate into the folder and then check inside for existing folders.

    So in your scenario where you are looking through your list for a specific name you are likely going to use the Get Folder and/or the List Folder Actions in order to grab the folders that currently exist

    Capture.JPG

     

     

     

     

     

     

     

     

    The big thing to note is that with the list you can setup a loop to go through and compare a specified value(such as name) to each item to see if it can identify the folder and confirm it exits, then if you have a variable that switched to true once it confirms it exists, you can use a condition after that to perform any steps you want or just skip to the create item in the folder, otherwise it has to go through and create the folder first.

     

     

    Documentation of the actions:

    https://docs.microsoft.com/en-us/Connectors/sharepointonline/#create-new-folder

    https://docs.microsoft.com/en-us/Connectors/sharepointonline/#get-folder-metadata

    https://docs.microsoft.com/en-us/Connectors/sharepointonline/#list-folder

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 395 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 328

#3
WarrenBelz Profile Picture

WarrenBelz 260 Most Valuable Professional

Last 30 days Overall leaderboard