Files and Folders in Office 365 Scope - How to determine if a folder exists

I am have a simple request, I wish to check a folder exists on a sharepoint site. If that folder does not exist then i wish to create it if not I will upload a file into the existing folder.

What I have done

  1. I have a Office 365 scope that is connected to my sharepoint site using ApplicationiD and secret authentication.
    2, I am using find files and and folders and I have setup the query box as the folder I wish to find, I have added the subfolder path, url and drive name.
  2. I have set a drive item for First item

This is my problem, I do not know how to find handle if the folder was not found, as I cannot reference the driveitem I have created to capture the result as when i do it states object does not exist.

Please can someone advise how I handle the find files and folders in an office 365 scope so I can easily know if a folder was found or not. I was expecting the files and folders tto return boolean to advise found but all it returns is driveitem, then I could easily do if not found create folder.

Obviously an common task but I cannot work out how to do it, any help would really be appreciated.

Thank you.

1 Like

@Paul_Guy

You can do this

IsNothing(firstitemvar) …if its nothing then create a folder else do not

Another eay assign variable to results and then check results.count>0

Hope this helps

Cheers

Can you show me how you configured it?

I’m having difficulty putting together this scenario: I have access with ApplicationiD and secret authentication, access to the site on Sharepoint, but I can’t recover the driveitem in any way.