Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Feb 24, 2013 08:12 PM by smirnov
Feb 04, 2013 07:02 PM|LINK
Hello again Experts,
I have 3 questions but I will be grateful for help with just one.
I have the following dropdownlist that gets populated from Active Directory.
I will like to make a few changes and I am not really sure how to get started.
First the code:
Private Sub FillEmplList()
Dim oroot As DirectoryEntry = New DirectoryEntry("LDAP://OU=domain.com,DC=NO...")
Dim osearcher As DirectorySearcher = New DirectorySearcher(oroot)
Dim oresult As SearchResultCollection
Dim result As SearchResult
Dim list As New List(Of String)
osearcher.Filter = "(&(objectClass=user))" ' search filter
osearcher.PropertiesToLoad.Add("cn") ' username
osearcher.PropertiesToLoad.Add("name") ' full name
osearcher.PropertiesToLoad.Add("givenname") ' firstname
osearcher.PropertiesToLoad.Add("sn") ' lastname
osearcher.PropertiesToLoad.Add("mail") ' mail
osearcher.PropertiesToLoad.Add("initials") ' initials
osearcher.PropertiesToLoad.Add("ou") ' organizational unit
osearcher.PropertiesToLoad.Add("userPrincipalName") ' login name
osearcher.PropertiesToLoad.Add("distinguishedName") ' distinguised name
oresult = osearcher.FindAll()
For Each result In oresult
If Not result.GetDirectoryEntry.Properties("name").Value Is Nothing Then
myname.DataSource = list
In additon to this dropdownlist, there are a few textboxes we like to get populated when a user name is selected from the dropdownlist above.
First question, when a user selects a username from the dropdownlist, we will like textboxs such as dept, telephone, office, etc to be populated based on selelected username from the dropdownlist
Second quetsion, we have another dropdownlist that gets populated, again from Active Directory.
This dropdownlist is filled with Department Supervisors. If I select my username from the first dropdownlist(above), we would like my supervisor's name to be automatically selected in the second dropdownlist.
Is this very difficult to accomplish?
Last question, when the first dropdownlist (the one shown above) is loaded, we would like the name of the logged in user to be default option on the dropdownlist.
I would be glad for solutions to all 3 issues but I am more than grateful to you experts for any help on any of the 3 issues.
Thanks a lot in advance
Feb 05, 2013 02:08 PM|LINK
No one has any solution to any of the issues?
Feb 24, 2013 08:12 PM|LINK
1) Filter = "(&(objectClass=user)(cn=selected user here))"
2) Filter = "(&(objectClass=user)(managedby=CN=manager name here))"