【问题标题】:novell.directory.ldap.netstandard MaxResultsNovell.directory.ldap.netstandard MaxResults
【发布时间】:2017-10-21 18:51:53
【问题描述】:

我正在使用我的 .net 核心项目中的 Novell.directory.ldap.netstandard 查询我的活动目录。

最多只能带回 1000 个用户,我知道这是因为服务器上的 PageSize 设置为 1000,我怎样才能获得带回所有 Active Directory 用户的代码? - 我正在使用异步搜索方法。

        string ldapHost = "";
        int ldapPort = ;
        string loginDN = "";
        string password = "";
        string searchBase = "";
        string searchFilter = "";
        string[] attributes = new string[] { "givenName", "sn"};

        LdapConnection ldapConn = new LdapConnection();

        ldapConn.Connect(ldapHost, ldapPort);

        ldapConn.Bind(loginDN, password);

        LdapSearchQueue queue = ldapConn.Search(searchBase, LdapConnection.SCOPE_SUB, searchFilter, attributes, false, (LdapSearchQueue)null, (LdapSearchConstraints)null);

        LdapMessage message;
        int i = 1;

        while ((message = queue.getResponse()) != null)
        {
            if (message is LdapSearchResult)
            {
                LdapEntry entry = ((LdapSearchResult)message).Entry;

                LdapAttributeSet attributeSet = entry.getAttributeSet();

                Console.WriteLine(i + " " + attributeSet.getAttribute("givenName")?.StringValue + " " + attributeSet.getAttribute("sn")?.StringValue);
                i++;
            }
        }

        ldapConn.Disconnect();

【问题讨论】:

    标签: .net active-directory ldap ldap-query novell


    【解决方案1】:

    在 LDAP 术语中,您需要使用页面结果控件。

    在 C# 中,这个问题似乎涵盖了它:https://stackoverflow.com/a/90668/7990687

    【讨论】:

    • 当我创建一个新项目并针对旧的 .net 框架时,我可以使用 DirectorySearcher 让它工作,但 DirectorySearcher 在 .net 核心中不可用,所以我必须使用第 3 方库来做到这一点这导致了我的问题,因为我不知道该怎么做。
    • 似乎该控件在小说库中不可用:novell.com/coolsolutions/feature/11204.html#5.1 也许您可以使用 VLV(虚拟列表视图)控件管理一些解决方法,但我不知道:/
    猜你喜欢
    • 2014-05-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-02-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多