Create Sharepoint folder if it does not exist, else add file to existing folder
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
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
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.