Jason Steeves wrote:
I am using the following code to get the properties of a folder and
everything is working ok but I need to find the "Current owner of this item"
for the specified folder.
Dim fileprops As FileInfo = New FileInfo(textbox2.Text)
CheckedListBox2.Items.Add(fileprops.CreationTime)
This depends on whether you use .NET 1 or .NET 2. In .NET 1, there's on
direct support for this and you have to use WMI to get to the
information. This has been covered in newsgroup posts many times, for
example at this Google Groups link:
http://tinyurl.com/9sdam
If you use .NET 2, you can query the information directly, like this:
DirectoryInfo directoryInfo = new DirectoryInfo(@"c:\Windows");
DirectorySecurity directorySecurity =
directoryInfo.GetAccessControl(AccessControlSectio ns.Owner);
IdentityReference identityReference =
directorySecurity.GetOwner(typeof(NTAccount));
Now you have the readable name of the user/group account in
identityReference.Value.
Hope this helps!
Oliver Sturm
--
omnibus ex nihilo ducendis sufficit unum
Spaces inserted to prevent google email destruction:
MSN oliver @ sturmnet.org Jabber sturm @ amessage.de
ICQ 27142619
http://www.sturmnet.org/blog