Last post Oct 01, 2009 10:01 AM by rasl
Dec 21, 2006 10:40 AM|BlackCatBone|LINK
Dec 22, 2006 08:15 AM|Jasbits1|LINK
Sercher is only a varible that retrives a value from a textbox, you can remove that.
Dec 30, 2006 04:56 AM|g12garg|LINK
i have used the following code to get the list of containers in the Active Directory:
DirectorySearcher srch2 = new DirectorySearcher("(objectCategory=container)");
when i used "distinguishedname" i get the following list:
This list is too big...
But actually i want the list where only one CN value exists.
Could u tell me how could i get it?
Also i can use filter, but it may be possible that on any other domain the list may be different . pls guide me.
Thanks, waiting for the reply.
Jun 28, 2007 04:33 AM|Min Min Zaw|LINK
I am new to DirectorySearcher. Here is my question.
I want to search firstname + lastname = somename. But I can only search by firstname or lastname like this
searcher.filter = "(&(firstname=" & txtname.text & ")"
searcher.filter = "(&(lastname=" & txtname.text & ")"
I want to do soething like this:
searcher.filter = "(&(firstname + lastname=" & txtname.txt & ")"
But this doesn't work.
Jun 29, 2007 04:08 AM|Novice.Net|LINK
You can't do comparisons like this because the filter in the searcher is passing a LDAP query. From what you are describng you would need to use a filter such as (&(objectcategory=person)(objectclass=user)) and then in the PropertiestoLoad part of the searcher
ask for "givenName" and "sn". When you then do a findall() the resulting collection can be iterated to find out if givenName = Sn. Also be aware that LDAP in AD will only return 1,000 objects at a time so you may need to use paging to get more.
The following links might help understand the LDAP query:
Oct 01, 2009 10:01 AM|rasl|LINK
I think that you will have to separate the firtname and lastname, like this:
& = AND
| = OR