SQLTeam.com | Weblogs | Forums

Email Distribution List

In the Report Server, there is a subscription table where I can get the emails, including the distribution lists, for a report.

Is there a way to extract the members from an Outlook Email Distribution list?

You will need to use LDAP query as follows.

SELECT Name, mail, displayName,givenname,sn, cn, 
distinguishedName, SAMAccountName, objectGUID, Department, 
adspath, manager  
  FROM OPENQUERY( ADSI,   
                  'SELECT Name, mail, displayName,givenname,
sn,cn,distinguishedName, SAMAccountName, objectGUID, 
Department, adspath, manager  
FROM ''LDAP://babyaqua.lan/DC=babyaqua,DC=lan''   
       where objectClass = ''User''   
         AND objectCategory = ''Person''   
		 and memberOf=''CN=_THE_DISTRIBUTION_GROUP,OU=Distribution,
OU=Groups,DC=babyaqua,DC=lan''
      AND ''userAccountControl:1.2.840.113556.1.4.803:'' <>2  ')   
2 Likes