By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
426,034 Members | 1,777 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 426,034 IT Pros & Developers. It's quick & easy.

DirectoryServices - "The administrative limit for this request was exceeded"

P: n/a
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);
}

}
}
}
Nov 15 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Big Dave,

When you uncomment the assignment to the PageSize property, does it
work? From the section of the Platform SDK titled "Retreiving Large Result
Sets", located at (watch for line wrap):

http://msdn.microsoft.com/library/de...sults_sets.asp

It states:

Many directory servers specify an Administrative Limit for the maximum
number of objects they can return if a client does not specify the page
size. When the Administrative Limit is reached, ADSI generates the
ERROR_DS_ADMIN_LIMIT_EXCEEDED Win32 error.

It looks like you are trying to get a good number of objects. You might
want to consider doing a paged search, and limiting the number of results
returned per page.

Hope this helps.

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Big Dave" <an*******@discussions.microsoft.com> wrote in message
news:09****************************@phx.gbl...
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);
}

}
}
}

Nov 15 '05 #2

P: n/a
Thanks, Nicholas,

Unfortunately when I uncomment out my pagesize code I get
the following error:

---
5
The value for the property PageSize could not be set.

---

Still don't know why I cant set it.

Dave
-----Original Message-----
Big Dave,

When you uncomment the assignment to the PageSize property, does itwork? From the section of the Platform SDK titled "Retreiving Large ResultSets", located at (watch for line wrap):

http://msdn.microsoft.com/library/default.asp? url=/library/en-
us/adsi/adsi/retrieving_large_results_sets.asp
It states:

Many directory servers specify an Administrative Limit for the maximumnumber of objects they can return if a client does not specify the pagesize. When the Administrative Limit is reached, ADSI generates theERROR_DS_ADMIN_LIMIT_EXCEEDED Win32 error.

It looks like you are trying to get a good number of objects. You mightwant to consider doing a paged search, and limiting the number of resultsreturned per page.

Hope this helps.

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Big Dave" <an*******@discussions.microsoft.com> wrote in messagenews:09****************************@phx.gbl...
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);
}

}
}
}

.

Nov 15 '05 #3

P: n/a
Nothing wrong with the code, could it be that the ""Administrative Server
time limit" is set to a (too) low value for this (unrealistic) query?
What OS are you running on the AD server(s)?

Willy.

"Big Dave" <an*******@discussions.microsoft.com> wrote in message
news:09****************************@phx.gbl...
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);
}

}
}
}

Nov 15 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.