Unable to get members of Distribution List using LDAP -
08-14-2007
, 04:28 PM
Hello,
I'm trying to get all the email addresses of a distribution list using .NET.
This DL also has nested DLs and need all the emails of there members. All I
have been able to get is the email of the main group. Here is my code:
Dim results As SearchResultCollection
Dim drsSearcher As DirectorySearcher
Dim dreEntry As DirectoryEntry
Dim val As SearchResult
Try
dreEntry = New DirectoryEntry("LDAP://xxx.xx.xxx.xx.xx")
dreEntry.AuthenticationType = AuthenticationTypes.ReadonlyServer
drsSearcher = New DirectorySearcher(dreEntry)
drsSearcher.Filter = "" 'I have no idea what to put for the
filter at this point
drsSearcher.SearchScope = SearchScope.Subtree
results = drsSearcher.FindAll
For Each val In results
lstProperties.Items.Add(val.Properties("mail").Ite m(0))
Next
lblCount.Text = results.Count
Catch ex As Exception
MsgBox(ex.Message)
End Try
I'm not too terribly familiar with LDAP, so any help would be appreciated. |