Enumerating all available objectClass?

Tech-Archive recommends: Fix windows errors by optimizing your registry



Hi all,

I'm new to AD querying (and AD itself, actually). I'm working in C#/.NET
2.0.

I need to enumerate all the available object classes defined in a given
domain. I'll use this list to fill a dropdown; when a selection is made,
I'll fill another list that only contains items that have the selected
value.

I can do this right now with the following:

string strDomain = "mydomainname";
System.DirectoryServices.DirectoryEntry entry = new
System.DirectoryServices.DirectoryEntry( "LDAP://"; + strDomain );
System.DirectoryServices.DirectorySearcher mySearcher = new
System.DirectoryServices.DirectorySearcher( entry );
mySearcher.Filter = "(objectClass=*)";
foreach( System.DirectoryServices.SearchResult resEnt in
mySearcher.FindAll() ) {
[...]
}

I can then build a list of objectClass'es as I iterate over the items
returned and look at their properties.

This works fine for a tiny domain, but obviously it's the completely wrong
approach, and will be unacceptably slow for a medium-sized one.

What's the accepted way of quickly retrieving all object classes currently
defined in the entire AD, so I can limit subsequent queries to
"(objectClass=[chosen class]")?


.