views:

330

answers:

1

I have performed an active directory search and now have a SearchResultCollection of all the users in active directory. I've specified all the properties that the DirectorySearch should load, but I also want to know what OU (distinguished name) each user is in. I know I could figure it out be getting a DirectoryEntry for each user, and look at the distinguished name of the directory entries parent directory entry, but this seems like it would be terribly slow. Is it possible to return the ou distinguished name some other way?

+1  A: 

Subtring-after the first comma?

cn=bob, ou=someOU,dc=this,dc=that

would seem to be your goal.

geoffc
That's what I ended up doing. Thanks.
Jeremy