In my workflow, i use path exist first to check if folder is exist or not.
If not exist then stop process.
My question is path exist activity able to check if the folder is can be access or not as well?
Or at least will the path exist activity throw an exception error if the folder can’t be accessed? So i can surround it with try catch and what is the catch type?
In the link of Get folder info activity, doesn’t mention “folder access”, so maybe this activity is not the answer i’m looking for.
And the link of stackoverflow, the idea is to use C# code and put it in invoke code activity.
The code logic is if the folder access at least read only (but in my requirements i need folder that have access read & write) return true else false. And to check the accessibility of the folder, also require code that get the current user identity first.
^ hmm idk this code seems will give new error in the future & is pain in the ass for me
And maybe i just got idea that more reliable, i will just use if pathExist = true then “try: activity write file.txt into that folder, if return exception access denied then catch: i don’t know the exception type is”, if not return exception then delete the file.txt (means the folder is accessible read & write isn’t it?).
You know what exception type to catch when return exception folder access denied?
Maybe “System.UnauthorizedAccessException”? Based on this image from google image:
yes, but i don’t have the object to testing this yet.
I just want to create this kind of validation just to make sure all folder path that the UiPath robot used all not problematic folder path before continue next process steps.
@Anil_G my first test is path exist is still able to found the shared folder (path exist = true), even tho i manually create new folder into the shared folder and resulting destination folder access denied.
so next test try create new file by UiPath robot into that shared folder to see the error exception.
@Anil_G ah, so the exception type is “System.AggregateException” hmm maybe System.UnauthorizedAccessException is for File while System.AggregateException is for folder but my requirement is to check folder so i will just use the catch block System.AggregateException based on my testing.
in the end i chage my activity from write text file activity to copy file activity and finally get the correct exception type: System.UnauthorizedAccessException
well in my requirement, there is a template file, will try just copy that template in all folder paths, if return error than send email notif to IT and stop process, else keep continue the process and delete the copied template.