Question extract securitygroup for a directory?

bigoudis

New member
Joined
Dec 10, 2024
Messages
2
Programming Experience
Beginner
hello, i'm new to c# programming. i've been following a few basic tuttos.first, i would like to do some simple things for my job.I want to know the securitygroups of a folder. I'm a little confused.
There's a DirectorySecurity class with methods. How can I extract this info? string dir = @"\\test"; DirectorySecurity acl = Directory.GetAccessControl(dir); byte[] original = acl.GetSecurityDescriptorBinaryForm();I have a error with Directory.GetAccessControl Directory does not contain a definition for 'GetAccessControl'thank you in advance for your help
 
Directory does not contain a definition for 'GetAccessControl'
If you have a .Net project you have to add Nuget package System.IO.FileSystem.AccessControl.
 
The package extends DirectoryInfo/FileInfo, so create one of those and GetAccessControl from there.
 
Back
Top Bottom