Try catch in for each

How to add Try catch in for each file name don’t exist to ship it. Please share sample files as I am new to studio

@Nas

Can you describe your automation? Where the FileName is coming from?

Thanks

i am trying to get get the file owner that are available in the network drive , some of the owner don’t Exist could yo please advice how to add Try Catch for each file name don’t exist Ownership ?

Here’s how you get the owner:

System.IO.File.GetAccessControl(path).GetOwner(GetType(System.Security.Principal.NTAccount)).Value
1 Like

@Nas

Did you try with Path Exists activity?

In Path Exists activity you have to give the entire path with the File name of the owner

If it exists then it returns True Else False

So you can place IF condition to decide

Hope this may help you

Thanks

1 Like