473,386 Members | 1,846 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,386 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 3053
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.