locked
LDAP Filter not working correctly RRS feed

  • Question

  • User-1623825264 posted

    I am using an ASP page to show a drop down list of OUs that a user can select from.

    The search query needs to return a filtered list of OUs, which excludes the OU  "Deactivated User Accounts".

    Here is the search filter:

    strFilter = (&(objectCategory=organizationalUnit)(!name=Deactivated User Accounts))

    It works fine if I use an OU name that contains no spaces.

    If I use any OU that contains a spaces, it appears to ignore it.

    If I take out the !(not), I get just the Deactivated User Accounts OU only, which is what I would expect.

    Any help would be greatly appreciated.

    Thanks

     

    Tuesday, August 15, 2006 11:59 PM

All replies

  • User1354132231 posted
    This seems to work for me just fine:

    (&(objectClass=organizationalUnit)(!OU=Container with Space in Name))
    Wednesday, August 16, 2006 8:45 AM
  • User-1623825264 posted

    Thanks for confirming that it should work.

    Strange that it won't work though.

    Works fine when I use AND(&) or OR(|), but not with NOT(!).

    Have had to test for OU name to get around it:

    ExcludeOU = "Deactivated"If  inStr(1,OUNames,ExcludeOU,1)<>0 then
      objRS.MoveNext
      Else
      %>
      <Option Value="<%=DNName & ":" & OUDesc & ":" & OUNames%>"><%=OUDesc & "(" & OUNames & ")"%>
      <%
      objRS.MoveNext
      End If

    Thursday, August 17, 2006 7:27 PM
  • User1297008538 posted
    Look a bit more closely at Ryan's reply, note he is using OU=Name with a Space, not name=Name with a Space.
    Monday, August 21, 2006 12:23 AM