Click here to Skip to main content
15,891,567 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
Hi Everyone

I have a need to create a list of all of the exchange distribution lists on our network. I need to insert the items in the list into a list box control on a form, so that my users can select the lists that they want our IT department to add a person to.

The problem I am having is that when I use LDAP to query AD for the groups using LDAP://OU=groups, I get groups, but they don't resemble the distribution list in exchange.

Is LDAP the correct method to use to do this? If not, what technology should I use?

I would appreciate any help I can get with this. Even if you only tell me where to look.

Thank you in advance.
Posted

1 solution

AD configurations can differ a bit. MY distro lists are accessible via

LDAP://OU=Distribution Lists,OU=LocalOU,OU=NotSoLocalOU,DC=Some,DC=Thing,DC=Else,DC=Here


But what do you mean by "don't resemble"? Completely wrong, or not in the format you think they should be in?

EDIT:
Howveer, IF your groups and distribution lists are all sitting in the same OU, you can distinguish them using the "groupType" property.

If the groupType is 2147483648 (0x80000000) (according to MS) or -2147483646 (according to my AD), it is a security group. Any other number (1,2,4,8,16, or 32) makes it a distro list.
 
Share this answer
 
v3
Comments
quincarroll 7-Apr-11 9:27am    
For example...

If I look at my Outlook address book, the distribution lists listed there are nothing like the lists returned by my lookup using:

LDAP://OU=groups,OU=loc-city-xxxx,DC=eu,DC=xxxxxxx,DC=com

If I replace "groups" with "Distribution Lists" then I get an error message "There is no such object on the server.

Do you know of any way I can find out what the correct object name I should be using?
I have successfully used "users" and "computers" for their respective lookups, but I can't find the correct one for distribution lists.
GenJerDan 7-Apr-11 9:31am    
DLs are just groups, separated out either by OU or the flag I mentioned above. Can you give an example of what you're seeing and what you expect to see? Outlook shows the displayName. It may differ from the cn and will surely differ from the distinguishedName. :^)
quincarroll 7-Apr-11 9:41am    
My GroupTypes are all -2147483640, so from your edit above, I can assume that they are the security groups. I'm not getting any with other numbers?

This is one of the groups that is returned by my query:

<adspath>LDAP://CN=Adm-MRU-DistGroupManagers,OU=Groups,OU=Loc-Mauritius-XXXX,DC=eu,DC=mmmmmmmm,DC=com
<cn>Adm-MRU-DistGroupManagers
<description>ADS: Distribution Groups Managers
<distinguishedname>CN=Adm-MRU-DistGroupManagers,OU=Groups,OU=Loc-Mauritius-XXXX,DC=eu,DC=mmmmmmmm,DC=com
<dscorepropagationdata>3/23/2011 4:22:33 PM
<grouptype>-2147483640
<instancetype>4
<name>Adm-MRU-DistGroupManagers
<objectcategory>CN=Group,CN=Schema,CN=Configuration,DC=mmmmmmmm,DC=com</objectcategory>
<objectclass>top</objectclass>
<objectguid>System.Byte[]</objectguid>
<objectsid>System.Byte[]</objectsid>
<samaccountname>Adm-MRU-DistGroupManagers
<samaccounttype>268435456
<usnchanged>54936
<usncreated>54936
<whenchanged>6/23/2010 4:29:36 PM
<whencreated>9/6/2007 3:34:29 PM
GenJerDan 7-Apr-11 9:49am    
The query is wrong. It should NOT start with "CN=". That's just looking at a particular object, not an OU. Cut it back to the first "OU=". If you don't have a way to browse the Directory (I use ADSIEdit.msc) to find where the Distribution Lists live, check with the Domain admin folks. They should have the info.
quincarroll 7-Apr-11 9:55am    
Sorry... My post above is the xml result of one of the AD records. The site seems to have stripped the tags.

The query I'm using is:

LDAP://OU=groups,OU=NetworkLocation,DC=eu,DC=CompanyName,DC=com

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900