Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C# 1.0 > C#
|
C# Programming questions specific to the Microsoft C# language. See also the forum Beginning Visual C# to discuss that specific Wrox book and code.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 15th, 2003, 09:06 AM
Registered User
 
Join Date: Oct 2003
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default search for null /String.Empty in Active Directory

I would like to search all the "user definded" folder in my active directory. Here is my LDAP filter.
//=====================
DirectoryEntry searchroot = new DirectoryEntry(ConfigurationSettings.AppSettings["ADsSearchRoot"]);

DirectorySearcher ds = new DirectorySearcher(searchroot);
ds.SearchScope = SearchScope.Subtree;
ds.Filter = "(&(objectCategory=organizationalUnit)(l=??))" ;
SearchResultCollection results = ds.FindAll();
//=====================

Here 'l' means "city"... I would like to list out all the "user definded" folders which has characters in the "city" field...(the city field is not empty).

Can any of you teach me how to do that? Thanks

George
 
Old October 16th, 2003, 08:09 AM
Registered User
 
Join Date: Oct 2003
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I've figured this out myself, here is the query.

ds.Filter = "(&(objectCategory=organizationalUnit)(l=*))";

Since AD properties are dictionary object.

George

Quote:
quote:Originally posted by georgeh
 I would like to search all the "user definded" folder in my active directory. Here is my LDAP filter.
//=====================
DirectoryEntry searchroot = new DirectoryEntry(ConfigurationSettings.AppSettings["ADsSearchRoot"]);

DirectorySearcher ds = new DirectorySearcher(searchroot);
ds.SearchScope = SearchScope.Subtree;
ds.Filter = "(&(objectCategory=organizationalUnit)(l=??))" ;
SearchResultCollection results = ds.FindAll();
//=====================

Here 'l' means "city"... I would like to list out all the "user definded" folders which has characters in the "city" field...(the city field is not empty).

Can any of you teach me how to do that? Thanks

George






Similar Threads
Thread Thread Starter Forum Replies Last Post
0, Empty Strings and Null Loralee Access 8 August 10th, 2005 10:13 PM
Don;t diplay text box if it is empty or null abdul_wasie Classic ASP Databases 5 May 20th, 2005 11:49 PM
About Active Directory apalmero VB How-To 1 April 8th, 2005 04:06 PM
Difference between null and empty string shoakat Classic ASP Databases 4 September 10th, 2004 11:40 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.