i have the groups names in the database
after getting them i get the manager from the active directory using directory searcher
like this

public string getGroupManagersMail(string groupname)
        DirectoryEntry drtEnt = new DirectoryEntry("LDPA=//DC=domain,DC=mil");
        DirectorySearcher ds = new DirectedorySearcher(drtEnt, "sAMAccountName" + groupname);
        SearchResult sr = ds.FindOne();

i do able to get his CN,OU,DC and displayd name of the manager
but i cant get his mail.
i have tried to search in the active directory by creating a new directory
entry with the params that i got in the searchresult but it didn't work
could be because the dispalys name is not in english
does anyone know the answer?

5 Years
Discussion Span
Last Post by piyush.agrawal

I've worked on this code

''' <param name="de">DirectoryEntry to use</param>
''' <param name="pName">Property name to set</param>
''' <param name="pValue">Value of property to set</param>
Public Shared Sub SetADProperty(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
        End If
    End If
End Sub


Edited by Ezzaral: Added code tags, snipped fake sig link.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.