Last post May 24, 2012 08:49 AM by gww
May 23, 2012 07:36 AM|coolblue|LINK
I need to retrieve all the staff within a query based distribution list via LDAP (unless anyone can suggest a better way)
I am already retrieving the staff records from AD but we then need to match them up to these distribution lists.
Can anyone help me with this?
May 23, 2012 10:23 AM|coolblue|LINK
Ok, I can now get the directory entry for the Query Based Distribution Group. However I am a little stuck on how I find all the staff within this group.....
May 23, 2012 11:03 AM|coolblue|LINK
After a lot of searching I think that I need to get hold of the query that makes up the Query based distribution group. Once I have this I assume I can run the query via the DirectorySearcher.filter and therefore get a list of users?
However non of the Groups seem to have the MSExchQueryFilter property which appears to be the one that would contain the dynamic query..... I have added the property via the propertiestoload.add() method of the DirectorySearcher object but it still does
What am I doing wrong?
May 24, 2012 08:49 AM|gww|LINK
The attribute that contains the query for the query based distro list should be msexchdynamicdlfilter. You will also need msexchdymanicdlbasedn. That should be the location where the list applies the filter to query the list of users to load.
You can use the following function to load all available properties of a directoryentry by providing its name.
Function GetAllProps(lookupobject as string)
Dim entry As DirectoryEntry = New DirectoryEntry(ldapstr, usernamestr, passwordstr)
Dim obj As Object = entry.NativeObject
Dim search As DirectorySearcher = New DirectorySearcher(entry)
search.Filter = "(name="& lookupobject &")"
Dim result As SearchResult = search.FindOne()
Dim Prop as string
If (result Is Nothing) Then
For Each Prop In result.Properties.PropertyNames
response.write(Prop & " : " & result.Properties(Prop)(0).ToString & "<br />")
Catch Ex as Exception