Retrieving Group or User Name for a file

ahmad_hamdan

Member
Joined
May 24, 2010
Messages
19
Programming Experience
Beginner
Hi all,

I am currently writing an app that should retrieve the group or user name of a file in windows system(show when you choose security tab after right click -> properties in a file), the problem is i can't find a class in .Net Framework that can help me with that

Does any one know how to do it, i don't need full code just point me to the direction that can help me with it :D .

Thanks in advance.
 
The FileSecurity Class is what you're looking for: FileSecurity Class (System.Security.AccessControl)

VB.NET:
        Dim fs As Security.AccessControl.FileSecurity = File.GetAccessControl("C:\pathtofilehere")

        For Each ace As FileSystemAccessRule In fs.GetAccessRules(True, True, Type.GetType("System.Security.Principal.NTAccount"))
            MessageBox.Show(ace.IdentityReference.Value)
        Next
 
Back
Top