I'm using the filewatcher object to monitor creation of files but I
would like to know how I can obtain who created it. Is there a way in
the 1.1 framework?
Hmmm... I'm not sure if this will give you exactly what you need, but
this is the closes I can come up with off the top of my head
Anyway, the filesystemwatcher's Created event passes the path of the
file in the FileSystemEventArgs reference. With that, you can get a
FileSecurity object like so:
Dim security As FileSecurity = File.GetAccessControl (e.FullPath) ' e
is the event arg reference
That can give you an owner...
Option Strict On
Option Explicit On
Imports System
Imports System.IO
Imports System.Security
Imports System.Security.Principal
Imports System.Security.AccessControl
Module Module1
Sub Main()
Dim security As FileSecurity = File.GetAccessControl("c:\users
\tom\documents\a.formated.xml")
Dim owner As IdentityReference =
security.GetOwner(GetType(NTAccount))
Console.WriteLine(owner.Value)
End Sub
End Module
Not sure if this will give you exactly what you want or not... but,
maybe you can play with it and see