Last post Dec 04, 2011 08:54 AM by gww
Dec 01, 2011 09:40 AM|mjaved39|LINK
Split off from http://forums.asp.net/t/1323744.aspx/1?Active+Directory+problem+updating#
Dear all please tell me i want to update manager feilds i can find it by manger property or superwisername ,,,,i cant set or get manger property pelase anyone help me thanks
Dec 02, 2011 03:52 PM|smirnov|LINK
Manager property contains a "distinguished name" (DN) - i.e. an LDAP path - for the manager's DirectoryEntry.
DirectoryEntry e = new DirectoryEntry("LDAP://cn=John Doe,cn=Users,dc=YourCorp,dc=com");
// If user already has reference to a manager, delete it.
e.Properties["manager"].Insert(0, "cn=Boss,cn=VIP Users,dc=YourCorp,dc=com");
Hope this helps.
Dec 04, 2011 08:54 AM|gww|LINK
If no manager has been applied to the user object, there will be no manager field to pull information from. Before trying to use any information from an account you will want to check to see if that field exists. You can use and if/else block or a try/catch
If e.properties.contains("manager") Then
'assign value to output field
'assign text to output alerting propery is not populated
mangertxt.text = e.properties.contains("manager")
managertxt.text = "Manager field is not populated"
If you want to set the manager name, you will want to make a function that looks up the distinguished name of the person you want to assign as the manager, using their samaccountname. The distinquishedname can be long and will not update correctly if its not formatted properly if you try to manually enter it.
Public Function Get ManagerDistinguishedName("bob.smith") as string
'enter code to search AD for "bob.smith" and return his distinguishedname
If you need specific samples of this i can post it later.