From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Clay Perrine
Sent: woensdag 14 januari 2004 22:33
To: [EMAIL PROTECTED]
Subject: RE: [ActiveDir] AD in .NET Visual Basic
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of De Schepper Marc
Sent: Wednesday, January 14, 2004 2:57 PM
To: [EMAIL PROTECTED]
Subject: RE: [ActiveDir] AD in .NET Visual Basic
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Carlos Magalhaes
Sent: woensdag 14 januari 2004 21:19
To: '[EMAIL PROTECTED]'
Subject: RE: [ActiveDir] AD in .NET Visual Basic
Hello Marc,
Welcome to the world of System.DirectoryServices. Could you please post the extended error to the list?
Just a few things,
1. You should specify
a search filter for your query, this will limit the amount of time it takes for
your query return results. An example to specify the search query =
mysearcher.Filter =
"(&(objectCategory=user)(objectCategory=person))"
2. It is best practice to actually load the required properties into the search, you can load them one by one or you can load a property array. For example loading 1 by 1 = mysearcher.PropertiesToLoad.Add("cn") or an array = mysearcher.PropertiesToLoad.AddRange(MYSTRINGARRAY)
3. Also as a good practice instead of doin result.findall at the
loop level rather try this
Dim results As
SearchResultCollection
Dim result As SearchResult
results = mysearcher.FindAll
Then in your loop try
For Each result In results
If
result.Properties.Contains("cn") Then
'do something with result
End
If
Next
The reason you should use .Contains is because if the property does not contain a value you will receive and error = Object not set to an instance...
As a test could you specify a username , password and authentication type in the directoryentry.
For example
Dim entry As New
DirectoryServices.DirectoryEntry("LDAP://ou=tele_dom
users,DC=PROD,DC=TELENET,DC=BE",<USERNAME>,<PASSWORD>,AUTHENTICATIONTYPE)
This is just to perform a test we can change this later.
Let us know about the extended error. You have obviously checked that the LDAP path is correct (sorry but I have to ask: P)
Active Directory Programming ? - http://groups.yahoo.com/group/adsianddirectoryservices
Carlos Magalhaes - ADSI MVP
-----Original Message-----
From: De
Schepper Marc [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, January 14, 2004 9:24 PM
To: [EMAIL PROTECTED]
Subject: [ActiveDir] AD in .NET Visual Basic
Hey all,
I'm trying to walk my first steps in .NET Visual Basic and I
want to
create a Web App to provide our people an
interface to run some common
tasks (since they won't
follow procedures....)
Is there someone who could help me with a simple sample app in
ASP.NET
that queries the AD and returns the list of
users in a dropdownbox? More
I don't need, the rest I do
it myself
I wrote some code, but running it from my WS returns me an error
teeling
me hey cannot contact the domain...whenever it
hits the for next
loop...My security is OK, I followed
Q329986...I choose for methode 1
and changed the
username for anonymous acces to a domain user
This is the code I used
PLEASE Help
Dim entry As
New
DirectoryServices.DirectoryEntry("LDAP://ou=tele_dom
users,DC=PROD,DC=TELENET,DC=BE")
Dim mySearcher As New
System.DirectoryServices.DirectorySearcher(entry)
Dim result As
System.DirectoryServices.SearchResult
Dim oValue As New
ArrayList
For
Each result In mySearcher.FindAll()
oValue.Add(Microsoft.VisualBasic.Right(result.GetDirectoryEntry().Name,l
en(result.GetDirectoryEntry().Name) - 3))
Next
User1.DataSource =
oValue
User1.Visible = True
Thx
Marc
*************************************************************
Dit e-mail bericht inclusief eventuele ingesloten bestanden kan informatie bevatten die vertrouwelijk is en/of beschermd door intellectuele eigendomsrechten. Dit bericht is uitsluitend bestemd voor de geadresseerde(n). Elk gebruik van de informatie vervat in dit bericht (waaronder de volledige of gedeeltelijke reproductie of verspreiding onder elke vorm) door andere personen dan de geadresseerde(n) is verboden. Indien u dit bericht per vergissing heeft ontvangen, gelieve de afzender hiervan te verwittigen en dit bericht te verwijderen.
This e-mail and any attachment thereto may contain information which is confidential and/or protected by intellectual property rights and are intended for the sole use of the addressees. Any use of the information contained herein (including but not limited to total or partial reproduction or distribution in any form) by other persons than the addressees is prohibited. If you have received this e-mail in error, please notify the sender and delete its contents.
*************************************************************
List info : http://www.activedir.org/mail_list.htm
List FAQ : http://www.activedir.org/list_faq.htm
List archive: http://www.mail-archive.com/activedir%40mail.activedir.org/