|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Getting File Owner with .NET 2I have the following VB.NET code (VS2005) to get the owner of a file. It
works fine on my PC but I get exception errors when accessing mapped drives. Documentation on the new classes is non-existant. strFile is a full path and filename. Private Function GetFileOwner(ByVal strFile As String) As String Dim FS As FileSecurity = File.GetAccessControl(strFile) Dim owner As Security.Principal.NTAccount = CType(FS.GetOwner(GetType(Security.Principal.NTAccount)), Security.Principal.NTAccount) Return owner.ToString End Function Any help would be appreciated. -- John G |
|||||||||||||||||||||||