How to get a Group DistinguishedName if only its name/CN is known using LDAP?

869 Views Asked by At

I have a group naming only CN=RA010-CAT-PAT-PUN , How can i get a distiguished name of this group by using LDAP , or by using System.DirectoryServices.Protocols? I have a LdapConnection,

 public LdapConnection GetLdapConnection()
{
    _ldapDirectoryIdentifier = new LdapDirectoryIdentifier(_currentDomain, _defaultPort);
    return new LdapConnection(_ldapDirectoryIdentifier);
}
public void GetLdapConnectionForusers()
{
    try
    {
        _ldapConnectionUsers = GetLdapConnection();
        _ldapConnectionUsers.AuthType = AuthType.Basic;
        _ldapConnectionUsers.SessionOptions.SecureSocketLayer = false;
        if (_communicationSecurity == 1)
            _ldapConnectionUsers.SessionOptions.VerifyServerCertificate = verifyCertificateCallBack;
        NetworkCredential network = new NetworkCredential(_userName, _password);
        _ldapConnectionUsers.Bind(network);
        IsLdapConnectionEstabilished = true;

    }
    catch (Exception ex)
    {
        IsLdapConnectionEstabilished = false;
        throw;
    }
}

By using SearchRequest, How can i get the distinguishedName for the group "RA010-CAT-PAT-PUN"?

Thanks in advance.

1

There are 1 best solutions below

2
On

Execute a search with the filter "cn=RA010-CAT-PAT-PUN", using SUBTREE_SCOPE, starting from an appropriate subtree.

But why do you have only the CN?