LDAP
Hello,
I'm trying to traverse the Active Directory structure, and the error that I'm getting is:
System.Runtime.InteropServices.COMException: The specified domain either does not exist or could not be contacted
Line 54: ShowEntry(ds.FindOne().GetDirectoryEntry())
The code is:
Dim ds As New DirectorySearcher
ds.SearchRoot = New DirectoryEntry("")
ds.Filter = "(|(&(objectCategory=user)(name=bmains)))"
ds.PropertyNamesOnly = True
ds.PropertiesToLoad.Add("name")
ds.CacheResults = True
ds.ReferralChasing = ReferralChasingOption.None
ds.Sort = New SortOption("name", SortDirection.Ascending)
'Was doing this, but this wasn't working either
'Dim srcColl As SearchResultCollection = ds.FindAll()
'For Each src As SearchResult In srcColl
' ShowEntry(src.GetDirectoryEntry())
'Next
'Erroring line; ShowEntry is a private method, but it's not even
'being called bacause the error occurs at ds.FindOne()
ShowEntry(ds.FindOne().GetDirectoryEntry())
'srcColl.Dispose()
ds.Dispose()
FYI I did import the System.DirectoryServices namespace. Now, this was working before, on another day. Could this be to a change on the network, or a network problem?
Thanks,
Brian
__________________
Brian
|