SharePoint - Upload attachment and create folder if it doesn't already exist

:bullseye: What is your goal?

Export a photo attachment from Survey123 to a specific folder in SharePoint. Create a folder based on a field in Survey123,if the folder name already exists do not create and upload folder to either the newly created folder or the existing folder.

:thinking: What is the problem & what have you tried?

I am not sure how to set up the filters to check if the folder name exists or not. I get error [400] Invalid Request from the Upload to SharePoint module. I don’t know what to reference in the filters.

:camera_with_flash: Screenshots (scenario flow, module settings, errors)

Hello,

It depends on your search query. If it’s strict enough that you don’t need to validate the results, you can use the simplest approach → map Total number of bundles: less than 1 for no results, greater than or equal to 1 for folders found.

If you do need to validate the search results, that will require additional steps.

Have a nice day,
Michal

Thank you for your response. I added those parameters for the filters but does not seem to work. One, it only looks like it’s activating one of the filters and not the other. I get an error message for the SP module for the Folder Exists filter. There are no folders to be found right now so it should always go the No Folder modules but it looks like it’s not doing that.

Hi @Angela_Reid Just use the custom http module to search the folder in sharepoint using this endpoint GET http://server/_api/search/query?query_parameter=value&query_parameter=value
GET http://server/_api/search/query(query_parameter=value&amp;query_parameter=<value>)
here you can pass the folder name and if it esists it will return the data if not will just return 0 bundles .
and then add a filter if bundle = 0 means no folder exists and not that means folder exists.