471,350 Members | 2,004 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,350 software developers and data experts.

folder owner properties

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)

Any ideas? Thanks,
Aug 10 '05 #1
1 2949
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
Aug 11 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Keith | last post: by
12 posts views Thread by Tom W | last post: by
1 post views Thread by Jason Steeves | last post: by
5 posts views Thread by Cyril Gupta | last post: by
17 posts views Thread by rdemyan via AccessMonster.com | last post: by
10 posts views Thread by SimeonD | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.