I have a shared drive which is elsewhere on a server. I want to get a notification which gives me the user name of the person who has modified any file present in the shared
I have got the fix to that, It can be achieved using the ObjectSecurity Class of .NET. In that we can use the GetOwner. It fetches the owner of the file who has modified / created a file. This is the piece of code which would help:
string owner = System.IO.File.GetAccessControl(e.FullPath).GetOwner(typeof(System.Security.Principal.NTAccount)).ToString();
Console.WriteLine(owner);