我有一个组只命名CN = RA010-CAT-PAT-PUN,如何通过使用LDAP或使用System.DirectoryServices.Protocols获得该组的名称? 我有一个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;
}
}
通过使用SearchRequest,我如何获得组“RA010-CAT-PAT-PUN”的distinguishedName?
提前致谢。
答案 0 :(得分:0)
使用SUBTREE_SCOPE使用过滤器option.clientId = /*Need client Id from appsettings.json*/
执行搜索,从适当的子树开始。
但为什么你只有CN?