I need to get the 'employeenumber' of all the employees whose 'epersonstatus=REMOVE' using an Ldap search implemented using .NET/C# like:
var connection = new LdapConnection("foo.bar.com:389");
connection.AuthType = AuthType.Anonymous;
connection.SessionOptions.ProtocolVersion = 3;
connection.Bind();
var request = new SearchRequest(
"dc=root,dc=com",
"(epersonstatus=REMOVE)",
SearchScope.Subtree,
new string[] { "employeenumber" });
Since there are thousands of entries I am using paged requests as proposed here: http://dunnry.com/blog/PagingInSystemDirectoryServicesProtocols.aspx
I have also checked that the server supports paged requests as proposed here: iPlanet LDAP and C# PageResultRequestControl
Once the flow reaches:
SearchResponse response = connection.SendRequest(request) as SearchResponse;
I get a DirectoryOperationException with message "The requested attribute does not exist".
By running the same query on a LDap client like softerra I get the entries (a thousand) and the error.
Some help would be greatly appreciated.
I had a similar issue.
When using paged search, I got the exception
"The server does not support the control. The control is critical."
, when using non-paged search I received results (at least as long as the filter restricted the maximum number).However I found out, that the error message is misleading - The problem was buried in the authentication.
Using
AuthType.Basic
(orAuthType.Anonymous
) I received the error. Bus as soon as I switched toAuthType.Ntlm
it worked.Hope this helps...