473,322 Members | 1,510 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 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 3051
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Keith | last post by:
I have a script which allows a user to upload and delete files from the server. Is it possible (and if so how) to do a check to see if the folder is empty (ie if the last file in a particular...
2
by: Garrett | last post by:
Need any help in determining which groups have been given security access to a folder. Searched DirectoryServices to no avail... Any Help?
2
by: John Regan | last post by:
Hello All I am trying to find the owner of a file or folder on our network (Windows 2000 Server) using VB.Net and/or API. so I can search for Folders that don't follow our company's specified...
12
by: Tom W | last post by:
What's the difference in these three?
1
by: Jason Steeves | last post by:
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...
5
by: Cyril Gupta | last post by:
Hello, I have a class inside another class. The Scenario is like Car->Engine, where Car is a class with a set of properties and methods and Engine is another class inside it with its own set of...
17
by: rdemyan via AccessMonster.com | last post by:
With A2003, I'm having trouble accessing files in a folder on another computer where back-end files, update files, etc are located. Here's the scenario: 1) Computer #1 - A2003 2) Computer #2 -...
3
by: eholz1 | last post by:
Hello PHP Group, I am having trouble setting permissions correctly so that the magickwand api (php 5.2) can read and write images. I usually read a file from one directory, create a magickwand...
10
by: SimeonD | last post by:
Hi Is there a way I can fnd the Owner of a folder, using vb.net? I know how to find the permissions, but I can't figure how to find the owner. Thanks SimeonD
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.