2017-05-22 67 views
0

我使用我的.net核心項目中的novell.directory.ldap.netstandard查詢我的活動目錄。novell.directory.ldap.netstandard MaxResults

它只能帶回最多1000個用戶,我知道這是因爲服務器上的PageSize被設置爲1000,我怎樣才能讓代碼返回所有活動目錄用戶? - 我正在使用異步搜索方法。

 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(); 

回答

0

在LDAP而言,你需要使用的頁面結果控制。

在C#中,這個問題似乎掩蓋它:https://stackoverflow.com/a/90668/7990687

+0

我能得到它使用的DirectorySearcher上班的時候我創建了一個新的項目和有針對性的在.net中提供的核心老.NET框架,但心不是的DirectorySearcher還讓我必須使用第三方庫來做到這一點,導致我的問題,因爲我無法找到如何做到這一點。 –

+0

似乎該控件在小說庫中不可用:https://www.novell.com/coolsolutions/feature/11204.html#5.1 也許你可以用VLV(虛擬列表視圖)管理一些解決方法,控制,但它是出於我的知識:/ – Esteban

相關問題