473,542 Members | 16,235 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

AD searcher doesn't return all results.

I use DirectoryServices namespace to search AD.
I use "(&(objectcategory=person)(objectClass=user))" search string to
retrieve all users. However I noticed that not all users are returned.

There's a user nick named, say, yyyyy, and another named rrrrr.
rrrrr is returned by the query, yyyyy is not. Whn I use SmaAccountName
query for each, both are returned and objectclass and objectcategory
properties of the records are the same.

Why isn't yyyyy returned in the main result set (all users)?
Here's my code:

string strLdap = "LDAP://myserver";
System.DirectoryServices.DirectoryEntry entry = new
System.DirectoryServices.DirectoryEntry(strLdap,"s rv\\user","password");
System.DirectoryServices.DirectorySearcher searcher = new
System.DirectoryServices.DirectorySearcher(entry);

if (Request.QueryString["Nick"] != null)
{
searcher.Filter = String.Format("(SAMAccountName={0})",
Request.QueryString["Nick"]);
}
else
{
searcher.Filter = "(&(objectcategory=person)(objectClass=user))" ;
}
System.DirectoryServices.SearchResultCollection resultsCol =
searcher.FindAll();

for(int i=0; i<resultsCol.Count; i++)
{

if(resultsCol[i].Properties["samaccountname"]!=null)
{
..... do stuff ...................

Jan 23 '06 #1
0 996

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

19
11130
by: Chris Allen | last post by:
Hi I'm new to PHP and I'm trying to create a Login Form. Once the user has logged in then he shouldn't have to log in again. The trouble is I'm getting a new session ID between every page and so it doesn't recognise the user. I've used Session_Start() which I thought was meant to maintain the session variables between pages but it doesn't...
0
1885
by: Jimmy | last post by:
Hi everybody, I've been looking for a different than operator for the directory searcher filter. Only I couldn't find one, and even in the MSDN tere is no mentioning of such an operator. Can anyone help me?
0
1379
by: James Thurley | last post by:
I'm trying to dynamically compile assemblies and cache them to disk, which seems to work fine. When the data I'm compiling from changes, I want to re-generate the assembly and use the new version. After I re-generate the assembly, I get the type I want from it and then invoke a static method. I have found the following behaviour: 1....
4
3487
by: Bob Bedford | last post by:
We have no access to a mysql NG on my provider's server, so we ask here: We have a long query (long in text) with a UNION between 2 select. We have been informed that some times the query doesn't return any result. We have tried on our server and we always get a result. BUT, trying on the hosting server, many times the query doesn't return...
0
1091
by: Johan | last post by:
Hi How do I preform a paged search using the Directory searcher in VB.NET? I'm getting the first 1000 entries in the AD when I'm doing a normal search using the Directory searcher, and then what??? How do I get the rest? I'we understod that need to do a paged search but how do I do that?
16
4875
by: Dany | last post by:
Our web service was working fine until we installed .net Framework 1.1 service pack 1. Uninstalling SP1 is not an option because our largest customer says service packs marked as "critical" by Microsoft must be installed on their servers. Now german Umlaute (ä, ü, ö) and quotes are returned incorrectly in SOAP fault responses. This can be...
2
1270
by: swannyfeng | last post by:
I have the idea about the web engine, it can improve the experience for the web searcher I have the idea about the web engine, it can improve the experience for the web searcher But I don't know the search engine technich. How can I find the investor or the partner? Thanks!
3
1900
by: mkjame | last post by:
Hi everyone! I am actually coding a php script and I want to return all the values that doesn't have a relation between two tables. Basically I have two tables, one is called users, the other one is called agents, the structure of the users table is the following: ID (auto_increment) | username (email address) | password the structure of...
2
1058
by: little susane | last post by:
Hi, I am trying to change "print results" for promt. I don't want the output to be in HTML, it should be alert boxes.It should be fairly easy, but every time i am changing the - > results.innerHTML = out; it stops working. thanks <head>
0
7384
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7321
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7564
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7718
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
7662
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5237
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3377
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
941
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
615
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.