I could read user name by using GetAccessControl function for 'Create function'
protected void mywatcher_created(object sender,FileSystemEventArgs e)
{
string user_name = System.IO.File.GetAccessControl(e.FullPath).GetOwner(typeof(System.Security.Principal.NTAccount)).ToString();
DateTime current = DateTime.Now;
lstCreate.Items.Add(e.FullPath.ToString());
lstCreate.Items[cCount].SubItems.Add(current.ToShortDateString());
lstCreate.Items[cCount].SubItems.Add(current.ToShortTimeString());
lstCreate.Items[cCount].SubItems.Add(user_name.ToString());
cCount += 1;
}
If I want to read user name for deleted , renamed or changed file , and GetAssessControl Function couldn't be used for those. I got error of 'filepath couln't find'.
So how can I read the user name of share folder.
I wrote deleted file by this function ,
protected void mywatcher_deleted(object sender, FileSystemEventArgs e)
{
string user_name = System.IO.File.GetAccessControl(e.FullPath).GetOwner(typeof(System.Security.Principal.NTAccount)).ToString();
CheckForIllegalCrossThreadCalls = false;
DateTime current = DateTime.Now;
lstDelete.Items.Add(e.FullPath.ToString());
lstDelete.Items[dCount].SubItems.Add(current.ToShortDateString());
lstDelete.Items[dCount].SubItems.Add(current.ToShortTimeString());
lstDelete.Items[dCount].SubItems.Add(user_name.ToString());
dCount += 1;
}
Replies
Know the answer? Post it — somebody with the same question will find it here.