bjwade62 Posted September 21, 2006 Posted September 21, 2006 Does anyone know how to get the owner (or last saved by) of a file? Thanks, Bernie Quote
mskeel Posted September 25, 2006 Posted September 25, 2006 Check out the FileSecurity class. And some sample code from here: FileSecurity sec = new FileSecurity(fileName, AccessControlSections.All); Debug.WriteLine("owner = " + sec.GetOwner(typeof(NTAccount))); foreach (FileSystemAccessRule r in sec.GetAccessRules (true, true, typeof (NTAccount))) { Debug.WriteLine(r.AccessControlType); // deny or allow Debug.WriteLine(r.IdentityReference); // who Debug.WriteLine(r.InheritanceFlags); Debug.WriteLine(r.IsInherited); Debug.WriteLine(r.PropagationFlags); Debug.WriteLine(r.FileSystemRights); // specific to the file system Debug.WriteLine(""); } You'll have to import some stuff at the top so be prepared for that... Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.