Setting the "manager" property in AD without knowing the user's LDAP url

unclepickle1

New member
Joined
Apr 5, 2012
Messages
1
Programming Experience
Beginner
I have a function that will allow me to edit the manager property of a user here:

VB.NET:
Public Shared Sub SetManagerProperty(ByVal de As DirectoryEntry, ByVal pName As String, ByVal pValue As String)


        'First make sure the property value isnt "nothing"
        If Not pValue Is Nothing Then
            'Check to see if the DirectoryEntry contains this property already
            If de.Properties.Contains(pName) Then   'The DE contains this property
                'Update the properties value
                de.Properties(pName)(0) = pValue
            Else    'Property doesnt exist
                'Add the property and set it's value

                'de.Properties(pName).Add("cn=" & frmOrganization.txtManagerName.Text & ",OU=Company,OU=Users,OU=Summit,OU=North America,DC=mycompany,DC=com")


            End If
        End If

    End Sub

But what if the manager is not in the Company OU? How can I edit this to search for him in the entire domain?
 

Latest posts

Back
Top