Last post Feb 19, 2013 12:26 PM by bbcompent1
Feb 13, 2013 04:05 PM|simflex|LINK
I am trying to come up with 2 DropDownLists, one employee DropDownList and the other, manager DropDownList.
First, I am not familiar with how Active Directory works but having done some research, I did find something like the code below which as I understand, represents Manager definition:
What group represents manager in Active Directory?
The bigger issue for me though is if I select employee from the first dropDownList, how does it populate the second dropDownList
with the manager of that employee?
From what I undersand, department is the attribute that relates employee to manager but how do I use this in code?
In normal cascading dropdownlist, I can select employee and list the department the employee belongs to in the first dropdownlist and in the second dropdownlist, I can select manager where department = theDepartmentListed in first dropdownlist.
That's querying the database but in my case, we are querying the Active Directory.
Can someone please show how to link the relationship between employee in first dropDownList and manager in the second dropDownList based on department?
Feb 13, 2013 04:24 PM|bbcompent1|LINK
Um, I think you are slightly off on where manager actually comes from. In AD, manager is an attribute of an Active Directory User object, it isn't an org unit like you are thinking it is. Unless you make the manager the org unit it won't essentially work
Feb 13, 2013 04:59 PM|simflex|LINK
Thank you very much bbcompent1 for your prompt response.
I have struggled with this for quite sometime.
Would you be kind enough to give me an example of how this should work?
Feb 13, 2013 05:04 PM|bbcompent1|LINK
Sure, what you would want to LDAP query on is the attribute instead of an organization unit as such. Read the article that the link goes to for a more clear explanation but in the nuts and bolts of it:
(AttributeName=*yourtexthere*) replacing AttributeName with the name of the attribute
(as defined by ldapDisplayName) and |replacing yourtexthere with the search criteria such as in the following examples:
(physicalDeliveryOfficeName=*Seattle*) or in your case, (Manager = "Doe, John")
Feb 13, 2013 07:34 PM|simflex|LINK
That's exactly where my problem lies.
Hard coding manager's names like (Manager
= "Doe, John")
For instance, when I select an employee from the first dropdownlist, we would like the manager of that employee to populate the second dropdownlist.
So, instead of (cn="manager="doe, john"), what would replace doe, john?
Please see example below for what I currently have.
Dim deEmployee As New DirectoryEntry("LDAP://CN=John Employee,OU=Sales,DC=Corp,DC=com")
deEmployee.[Property]("manager") = "CN=Peter Manager,OU=Sales,DC=Corp,DC=com"
Feb 19, 2013 12:16 PM|bbcompent1|LINK
Hey simflex, I haven't forgotten you, been doing research on how to query the manager name by employee. I hope to have something for you soon.
Feb 19, 2013 12:26 PM|bbcompent1|LINK
Ok, I think I have a theory on how you can do this. First of all, query the user's details and capture "manager" in a session variable.
Then run another AD query using the "manager" property for the query to show all users based upon that property. Below is a link that involves troubleshooting to find details by propertyname.