Creating an Address List

Address lists are special groupings of email accounts that allow users to quickly find specific email users that are part of some logical grouping in the GAL. The RUS is responsible for creating and maintaining the address list links to the mail-enabled objects. The RUS links an address list to mail-enabled objects by adding the address list’s distinguished name to the object’s showInAddressBook multivalue attribute. Once an address list has been created, it can take hours or days for the RUS to fully populate the list by stamping all related objects’ showInAddressBook attributes, depending on the size of your organization.

A curious point about address lists is that even though an LDAP filter is used to specify who should and shouldn’t be in the list, Exchange doesn’t actually use the filter to do an LDAP lookup against Active Directory. Instead, the RUS does its own compare on objects one by one. This is why you can’t specify a search base where the address list should start; it encompasses the entire forest including the configuration container. This means you need to be very careful with the filter so that it is limited to the objects you truly want displayed. A positive aspect of this implementation is that it doesn’t matter if you select indexed attributes for the filter. Since the RUS isn’t using LDAP to resolve the objects from the filter, performance is not affected by any indexes on the attributes. One final note: be careful if you use the preview button in the Exchange System Manager to verify the list’s validity. That method will use an LDAP query against Active Directory to display the values, and has no bearing on whether the list is built yet or even what will end up on it. It is possible in certain cases that the preview will not match with what you actually get in the address list.

Address lists are represented in Active Directory by the addressBookContainer class. This is a simple class. The main value, the address list filter, is stored in the purportedSearch attribute.

Using a graphical user interface

Using the GUI for this process is straight forward and is the most likely way you’ll want to create address lists unless you need to create a lot of them on the fly or you are importing them from a test lab.

Using a command-line interface

As mentioned previously, you need to be very careful with the filter you specify for the purportedSearch attribute. The slightest mistake can cause the filter to not produce any results or produce an incorrect or incomplete result set. A filter such as (!attrib=value) instead of (!(attrib=value)), while acceptable to Active Directory’s LDAP parser, will cause undefined results when interpreted by the RUS. The only way to verify that the list has been properly built is to manually compare what the query should generate with what has been generated.

To do this comparison, first generate a list of distinguished names that are members of the address list. This is done by using LDAP to query for all mail-enabled objects that have the address list distinguished name listed in the showInAddressBook attribute (e.g., (&(mailNickname=*)( showinaddressbook=cn=All Users,cn=All Address Lists,cn=Address Lists Container,cn=RALLENCORP,cn=Microsoft Ex-change,cn=Services, cn=Configuration,dc=rallencorp,dc=com)) ). Next, generate a list of distinguished names that are matched by the query you used for the address list. Finally, compare these lists.

Using a graphical user interface

  1. Open the Exchange System Manager (ESM) snap-in.
  2. In the left pane, browse to the Recipients -> All Address Lists container.
  3. Right-click on the All Address Lists container and select New -> Address List.
  4. Enter the address list name.
  5. Click on Filter Rules, configure the filter settings, and click OK.
  6. Click Finish.

Using a command-line interface

First, create an LDIF file called add_al.ldf with the following contents:

dn: CN=<Address List Name>,<ParentDN>changetype: addcn: <Address List Name>

displayName: <Address List Name>

objectClass: addressBookContainer

purportedSearch: <LDAP Filter>

systemFlags: 1610612736

Replace <Address list Name> with the name of the address list and <ParentDN> with the distinguished name of the Address Lists container in Active Directory (e.g., cn=All Address Lists, cn=Address Lists Container, cn=RALLENCORPMAIL, cn=Microsoft Exchange, cn=Services, cn=Configuration, dc=rallencorp, dc=com). Then, run the following command:

>ldifde -i -f add-al.ldf

Using VBScript

' This code creates an Address List.' ------ SCRIPT CONFIGURATION ------

strParentDN  = "<DN to All Address Lists Container>"

' e.g., CN=All Address Lists,CN=Address Lists Container,

' CN=RALLENCORPMAIL,CN=Microsoft Exchange,

' CN=Services,CN=Configuration,DC=rallencorp,DC=comstrObjClass = "addressBookContainer"

strALName = "<Address List Name>"   ' e.g., Sales Dept

strFilterAttrib = "purportedSearch"

strFilter = "<LDAP Filter>"   ' e.g., (&(department=sales)(homemdb=*))

' ------ END CONFIGURATION ---------

' Set Dynamic values

set objOU = GetObject("LDAP://" & strParentDN)

set objNewObj = objOU.Create(strObjClass,"cn=" & strALName)

objNewObj.Put "displayName",strALName

objNewObj.Put strFilterAttrib,strFilter

' Set static values

objNewObj.Put "systemFlags",1610612736

' Save object

objNewObj.SetInfo

Wscript.Echo "Successfully created address list."