Finding the user who modified the shared drive folder files

后端 未结 1 399
盖世英雄少女心
盖世英雄少女心 2021-01-03 14:03

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

相关标签:
1条回答
  • 2021-01-03 14:13

    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);
    
    0 讨论(0)
提交回复
热议问题