0

I am trying to create a program to log all the users that access a shared network profile. We have a Windows network setup and all user profiles are through Active Directory.

Users are provided access to \sharedDrive\voicemails . I have created a C# program that logs a new entry and a change/delete on the folder. I would like to add the user name of the person who changes/renames/deletes the file. Since, the folder is on the network, using the Environment.GetEnvironmentVariable("USERNAME") only gets my username. Whereas, I would like to log the username of the person who is on the network drive and making changes.

Please help me with this problem. I haven't worked in this domain before and would appreciate any pointers or help.

Thank you!

geeksikh
  • 1
  • 3
  • Possible duplicate of [Find out username(who) modified file in C#](http://stackoverflow.com/questions/11660235/find-out-usernamewho-modified-file-in-c-sharp) – caesay Feb 05 '16 at 03:13
  • The code at the page does not work to get the username. I have the code that would register the file changes, but once I accommodate the code and use the GetSpecificFileProperties method, I get nothing. The program does not register any changes in the folder. It is difficult to troubleshoot the code, since I do not have much knowledge about the Shell32 library. There are no errors or exceptions at Build. I would appreciate any pointers on how I can better understand the controls, since the problem seems to be logical. – geeksikh Feb 06 '16 at 09:59

1 Answers1

0

This is a similar (duplicate?) question to Find out username(who) modified file in C#

Where the accepted answer describes a way to query a file path for the last user who modified it using a COM reference to the library "Microsoft Shell Controls And Automation".

Community
  • 1
  • 1
caesay
  • 16,932
  • 15
  • 95
  • 160
  • I will test the solutions, but that may not be the case. Thank you, Caesay! – geeksikh Feb 05 '16 at 08:39
  • It did not help. There is no clarification in the post or by Microsoft as to what is returned in the query and how it is structured. – geeksikh May 03 '16 at 06:50