B
Big Dave
Hello All, I was wondering wether anyone could help me
solve what is probably a very easy issue. I keep getting
this damn "The administrative limit for this request was
exceeded" whenever I try to query my LDAP server. Does
anyone have any idea how to fix this. I have tried the
pagesize and the sizelimit to no avail. Please help.
---
Here is my code below:
---
using System;
using System.DirectoryServices;
namespace Accounts_In_Out_C
{
/// <summary>
/// Summary description for Class1.
/// </summary>
class Class1
{
/// <summary>
/// The main entry point for the
application.
/// </summary>
[STAThread]
static void Main(string[] args)
{
//int ppsize = 5;
///This is my attempt to create
code that will search a LDAP server
DirectoryEntry DirEnt = new
DirectoryEntry("LDAP://somecomputer:389/o=somecompany,
c=somecountry");
DirectorySearcher DirSrc = new
DirectorySearcher(DirEnt);
DirSrc.SearchScope =
SearchScope.Subtree;
DirSrc.ReferralChasing =
ReferralChasingOption.All;
//DirSrc.Filter = "(description =
*)";
DirSrc.SizeLimit = 1000000;
//DirSrc.PageSize = ppsize;
//Console.WriteLine
(DirSrc.PageSize);
try
{
foreach(SearchResult
result in DirSrc.FindAll())
{
DirectoryEntry
dirEntry = result.GetDirectoryEntry();
foreach(string
key in dirEntry.Properties.PropertyNames)
{
//Each
property contains a collection of its own
//that
may contain multiple values
foreach
(object propVal in dirEntry.Properties[key])
{
Console.WriteLine(key + " = " + propVal);
}
}
Console.WriteLine
("---------------");
}
}
catch(Exception ex)
{
Console.WriteLine
(ex.Message);
}
}
}
}
solve what is probably a very easy issue. I keep getting
this damn "The administrative limit for this request was
exceeded" whenever I try to query my LDAP server. Does
anyone have any idea how to fix this. I have tried the
pagesize and the sizelimit to no avail. Please help.
---
Here is my code below:
---
using System;
using System.DirectoryServices;
namespace Accounts_In_Out_C
{
/// <summary>
/// Summary description for Class1.
/// </summary>
class Class1
{
/// <summary>
/// The main entry point for the
application.
/// </summary>
[STAThread]
static void Main(string[] args)
{
//int ppsize = 5;
///This is my attempt to create
code that will search a LDAP server
DirectoryEntry DirEnt = new
DirectoryEntry("LDAP://somecomputer:389/o=somecompany,
c=somecountry");
DirectorySearcher DirSrc = new
DirectorySearcher(DirEnt);
DirSrc.SearchScope =
SearchScope.Subtree;
DirSrc.ReferralChasing =
ReferralChasingOption.All;
//DirSrc.Filter = "(description =
*)";
DirSrc.SizeLimit = 1000000;
//DirSrc.PageSize = ppsize;
//Console.WriteLine
(DirSrc.PageSize);
try
{
foreach(SearchResult
result in DirSrc.FindAll())
{
DirectoryEntry
dirEntry = result.GetDirectoryEntry();
foreach(string
key in dirEntry.Properties.PropertyNames)
{
//Each
property contains a collection of its own
//that
may contain multiple values
foreach
(object propVal in dirEntry.Properties[key])
{
Console.WriteLine(key + " = " + propVal);
}
}
Console.WriteLine
("---------------");
}
}
catch(Exception ex)
{
Console.WriteLine
(ex.Message);
}
}
}
}