Owner (or last saved by) of a file

Check out the FileSecurity class.

And some sample code from here:
C#:
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("");
}
Youll have to import some stuff at the top so be prepared for that...
 
Back
Top