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);
        ds.PropertiesToLoad.Add("managedby");
        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?
}

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
            de.Properties(pName).Add(pValue)
        End If
    End If
End Sub

Piyush

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.