How to Test Try- catch with folderitem

How can I get make or create a folderitem so it will fail?
I’d like to see if my code works

Could misspell the filename to test the exists=false path. Also, set its permissions to make it read- or write-only or no-access.

Edit: or the same for the folder it’s in.

Forgot to add the real test is for some recursion sections.

You mean descending into a directory structure?

Yes. If one of those works it should be fine

Not sure it’s an answer for your case, but if one folder in the path has no access (permissions denied for the current user), you won’t be able to recurse to it.

1 Like