473,320 Members | 1,838 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,320 software developers and data experts.

Properties.PropertyNames - get the value for a specified property

1
I'm new to C# and ASP.NET....with that said...

In the below script I'm able to display the ouPersonUUID to a textbox.
but watching the script run via the debugger, it displays the results for all the
Directory Services properties.

How would I rewrite the script to search on one property and take the value of the property and store it for later use.?
Any help would be greatly appreciated.
Pen


// Create a DirectorySearcher object.
DirectorySearcher mySearcher = new DirectorySearcher(de);
mySearcher.SearchScope = SearchScope.Base;


// Use the FindOne method to find the user object.
SearchResult resEnt = mySearcher.FindOne();

foreach (string propKey in resEnt.Properties.PropertyNames)
{
// Display each of the values for the property
// identified by the property name.
foreach (object property in resEnt.Properties["ouPersonUUID"])
{
Console.WriteLine("{0}:{1}", propKey, property.ToString());
object oid = property;
num2 = Convert.ToInt32(property.ToString());
idTextBox.Text = Convert.ToString(num2);
}
}
Aug 22 '07 #1
1 1689
jhardman
3,406 Expert 2GB
moved to .NET forum
Aug 23 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: ytrewq | last post by:
Should dynamic ("expando") properties be restricted to native and user-defined objects? Or should host objects - such as references to the browser or a plug-in or to the document and its elements -...
3
by: wang.qiang | last post by:
I can't list the key-value pairs at runtime.The pairs list can not be retrieved. below is what I wrote DirectoryEntry nodeAdmin = de.Children.Find("IISAdmin","IIsWebVirtualDir") // ...
15
by: Gary Morris | last post by:
Hello all, OK, first of all I have known about properties since VB6, which I have and have used extensively. It seems that property get and set are basically the same concept in C# and VB.NET,...
1
by: Hardy Wang | last post by:
Hi, I am using DirectoryEntry to access IIS properties. After searching MSDN, I get "The Internet Information Services (IIS), and WinNT providers do not currently support Count, so each will throw...
3
by: agarrettb | last post by:
Hi all, I have a directory entry object the specifies "members" in its properties collection to retrieve: groupEntry.Properties("member") Instead of just using "member" to return members I...
1
by: shlomy | last post by:
how i can know all the properties of user that i get from active directory - that exist (i dont know there names) thanks
0
by: AdamKadmon | last post by:
Hello Group, Below is (mostly)functional code that enumerates certain properties for all of the groups in my Active Directory. My question is contained within comments as well as here: Once I...
5
by: =?Utf-8?B?bWljaGFlbCBzb3JlbnM=?= | last post by:
Prior to C# 3.0, I would typically define a property of a custom user control with pattern A: === PATTERN A ========== private bool myBool = true; public bool MyBool { get { return myBool; }...
4
by: Nathan Sokalski | last post by:
I have a System.Web.UI.Control which has a property of type System.Drawing.Font. When editing this control in an *.aspx file, how do I assign a value to this property? If I recall correctly, the...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
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...
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)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
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

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.