Question

So got to put some data structure for employee-manager relationship in Active diractory.

The employee list already exists in Active directory. Can I create Manager group and assign some employee as Manager. After that can I assign some other employee to those managers.

Please help. TIA Ron

Was it helpful?

Solution

Each object of type Person in Active Directory already has a Manager attribute.

By setting the manager's DN (distinguished name) into that attribute, you're effectively assigning a user to his/her manager.

DirectoryEntry deEmployee = new DirectoryEntry("LDAP://CN=John Employee,OU=Sales,DC=Corp,DC=com");

deEmployee.Property["manager"] = "CN=Peter Manager,OU=Sales,DC=Corp,DC=com";
deEmployee.CommitChanges();

The employees will all already have a Manager attribute - just populate those with the DN (distinguished name) of their managers - and you should be set.

Of course - those managers also have a Manager attribute, so you can create any depth of managerial hierarchy as you wish

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top