Couldn't find "System.IO.File.GetAccessControl" Function

Hi Everyone,

I would like to get the owner of file and search the topic and found Find owner/creator of a file

I try to put the function “System.IO.File” but not can’t find option “.GetAccessControl”

Thank you.

@aeklikit

I believe you are on windows project…it is available only on legacy…as per official docs its available in 4.8.1 or lower…windows is on 5.0+

create a project in legacy to get this

in windows try this

System.IO.FileSystemAclExtensions.GetAccessControl(New FileInfo("Filepath"))

image

Hope this helps

cheers

Hi @aeklikit .
Have you tried
System.IO.File.GetAccessControl(path).GetOwner(GetType(System.Security.Principal.NTAccount)).Value
could you please show your folder
regards

1 Like

Hi @Anil_G

I have try “System.IO.FileSystemAclExtensions.GetAccessControl(New FileInfo(“Filepath”))” on my Windows flow is work

Could you please explain about “as per official docs its available in 4.8.1 or lower…windows is on 5.0+”?
because I’m developer but user learn to use UiPath.

Thank you very much

@aeklikit

System.IO.File.GetAccessControl is available in .net 4.8 or below

this function is moved to a different library in the new .net version
System.IO.FileSystemAclExtensions.GetAccessControl

Hope this helps

UiPath windows-legacy is developed on .net 4.5-
UiPath windows is developer on .net 5+

cheers

1 Like

Hi @Nguyen_Van_Luong1

I already try this function first but doesn’t work because my flow is “Windows” compatibility.

But now I have try “System.IO.FileSystemAclExtensions.GetAccessControl(New FileInfo(“Filepath”))” as @Anil_G suggestion is work.

Thank you so much.

Noted, I’m so grateful for your help.

1 Like

Good job
Cheer @aeklikit ,

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.