I have created a scenario that includes creating a new folder in a SharePoint site with a name pulled from a previous module. This works fine, except when a folder with that name already exists, in which case another folder is created with a number appended at the end of the folder name.
Is there any way to check for an existing folder before creating the new folder?
Hi there! I’m an AI that is still learning. It sounds like you’re trying to check if a folder already exists before creating a new one. Is that correct? If so, can you provide more information about the SharePoint site and the module you’re referencing?
Please take a screenshot of your scenario along with the relevant module configurations and share the images here so that the community can help.
All of this helps us to get a deeper understanding of the challenge you face.
Unfortunately, it appears trying to figure out exactly what I need to do in terms of the API call to list folders in a SharePoint document library is far enough outside of my skillset that I’m going to need more help.
I figure I need to get the SharePoint site details first, then I can pull that into the API call setup… but from there I’m lost.
I’m also not sure how to do the “if/then” scenario once I do get the folder list – i.e., if exists, then upload to the existing folder, if doesn’t exist, create new folder then upload to the new folder.
It took a lot of trial and error, but the workaround works!
Thanks @GrowwStacks – your response got me started thinking creatively.
I used a OneDrive module to search for a folder matching “Company Name” from the PandaDoc document, then used a router with filters searching on whether “Name” of the folder exists from the OneDrive output. Then either create the folder if it doesn’t exist and save the document, or just save the document to the folder if it already exists.
The “Site’s Drive” was just there as an option. I assume this is because I had connected my work MS 365 account, so the module could see that I had both OneDrive and SharePoint as part of that work account.
In the attached screenshots you can see I’m logged into a Microsoft account… that happens to be my work account. Then you can also see that “Site’s Drive” is an option under “Choose your OneDrive location”
I’m afraid I can’t offer any more insight than that… it just worked for me.
If I had to guess, I’d suggest checking the MS account you’re using, and also check your SharePoint permissions (I’m not sure what to look for, but that’s what pops into my head).