jpkomick
jpkomick

Reputation: 38

C# failing LDAP queries

I'm trying to access an LDAP directory via the SearchRequest object in C#. I can make the same calls via an LDAP library running in and iPhone app, as well as directly via a terminal session. However, the C# queries all seem to fail.

var search = new SearchRequest("ou=calendar,dc=ualberta,dc=ca", "term=*,course=094398,class=*", System.DirectoryServices.Protocols.SearchScope.Subtree, attributeLst);

This returns a list of terms for the course calendar. However, making the following calls won't return results for specific courses

var search = new SearchRequest("ou=calendar,dc=ualberta,dc=ca", "term=1330,course=094398", System.DirectoryServices.Protocols.SearchScope.Subtree, attributeLst);

The attributeLst object has proper attribute names included, but the query always returns with zero results.

Any suggestions anyone has would be greatly appreciated. Thanks.

Upvotes: 0

Views: 844

Answers (1)

Ta01
Ta01

Reputation: 31630

Could it be related to the underlying LDAP property, i.e course's ldap datatype, i.e. is it one of the various strings or an integer in the LDAP store, if so the leading zero may throw it off? Also, I'm curious, logical and's (atleast when querying AD which is an LDAP implementation - not sure what your underlying store is) typically follow something like this:

(&(term=1330)(course=094398)) 

Upvotes: 1

Related Questions