>
Interesting
that 'user' is not a valid objectcategory. When I had ADUC create the
query for me,
> it
automatically generated the filter that included objectCategory=user. New Query / Custom
> Search /
then Display Name Is Exactly (space
character).
The attribute "objectCategory" is of syntax
distinguishedName and naturally requires a syntactically compatible value.
AD, however, is smart enough to take a non-DN value for objectCategory and
derive a DN from it, assuming the constructed DN results in a viable schema
entry, AD then reads the value of the resulting object's defaultObjectCategory
property and substitutes the original query-value with the
defaultObjectCategory value thereby permitting the query to proceed without
error.
e.g. if the filter provided contains
"(&(objectCategory=user)(sn=wells))"
-
1. construct DN
-
cn=user,cn=schema,cn=configuration,dc=mset,dc=local
2. read DN's defaultObjectCategory
value
-
CN=Person,CN=Schema,CN=Configuration,DC=mset,DC=local
3. modify original query and execute, resulting query
-
-
"(&(objectcategory=CN=Person,CN=Schema,CN=Configuration,DC=mset,DC=local)(sn=wells))"
... in truth, it's not quite what you asked for ... but
since (technically speaking) you asked for it incorrectly, it gives you
something close :o)
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Sitton Glen E
Sent: Wednesday, February 08, 2006 1:06 PM
To: [email protected]
Subject: RE: [ActiveDir] DSQUERY filter for space character only
Thanks Joe. I did use that MSDN article before I posted, but it didn't list the escape
sequence for the space character. Knowing what I know now, I probably
should have pieced it together considering that %20 is the space character
in a URL.
Interesting that 'user' is not a valid
objectcategory. When I had ADUC create the query for me, it automatically
generated the filter that included objectCategory=user. New Query / Custom Search /
then Display Name Is Exactly (space character).
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of joe
Sent: Tuesday, February 07, 2006 5:39 PM
To: [email protected]
Subject: RE: [ActiveDir] DSQUERY filter for space character only
The tricky piece here is the space, the displayname=\20
mechanism would work as well as the very cute little query Dean posted of
displayname<=!. Check out http://msdn.microsoft.com/library/default.asp?url="">.
It talks a little about constructing queries.
The other thing that stuck out to me appears to have stuck
out to you is the fact that everyone was using objectcategory=user. The user
class isn't a valid objectcategory. Luckily AD figures that out for you and
changes the query to objectcategory=person. However, that may not be the query
the OP wanted because that will return matching users and contacts.
Since displayname is indexed, you could probably get away
with the query (&(objectclass=user)(displayname=\20)). The tried and true
test would be to submit that query up against
(&(objectcategory=person)(objectclass=user)(displayname=\20)) or even
(&(sAMAccountType=805306368)(displayname=\20)) with the STATS control and
see what indexes get used, I would expect displayName
generally.
I just did a trace and took a peek and the displayname=" "
doesn't even get to the server, the client dumps it as a bad query before
then.
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of David Aragon
Sent: Tuesday, February 07, 2006 2:19 PM
To: [email protected]
Subject: RE: [ActiveDir] DSQUERY filter for space character only
Have you tried:
(&(objectCategory=Person)(objClass=User)(displayName=\\
))
David Aragon
Your ability to perceive a solution is
limited
only by your understanding of the problem
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Sitton Glen E
Sent: Tuesday, February 07, 2006 9:17 AM
To: [email protected]
Subject: [ActiveDir] DSQUERY filter for space character onlyI need to run an obscure DSQUERY with a filter that finds displayNames with a value of a single space character. I'm stumped. I've tried every escape character possibility that I'm aware of. I know how to find null values, but can't seem to query on a space character alone. It hoses the ldap syntax.When ADUC builds the ldap query itself, it fails:(&(objectCategory=user)(displayName= ))The query filter ... is not a valid query string.I've tried:" "' '%20+and escaping it with a \ or a ^Any ideas?Thanks in advance,- Glen
