NoName
NoName

Reputation: 1025

How to check if address lists exist in Active Directory?

I need to check if All Global Address Lists, All Address List and All System Address Lists exist in Active Directory before get all item from them.

Could you give me some advices or article that I can solve my problem?

Thanks.

Upvotes: 0

Views: 286

Answers (1)

Ashigore
Ashigore

Reputation: 4678

Address Lists are part of Exchange functionality not Active Directory which is what I think people are confused about.

Anyway, Address List data is stored in the Active Directory Configuration context under:

CN=Address Lists Container,CN=<EXCHANGE ORGANIZATION NAME>,CN=Microsoft Exchange,CN=Services,CN=Configuration,DC=<DEFAULT NAMING CONTEXT>

You can use ADSIEdit to view the information.

In C# you can use an LDAP query to retrieve information for existing Address Lists.

Edit: Something like this:

DirectoryEntry rootDSE = new DirectoryEntry("LDAP://RootDSE");
DirectoryEntry configContainer = new DirectoryEntry("LDAP://" + rootDSE.Properties["configurationNamingContext"].Value);
DirectorySearcher configSearcher = new DirectorySearcher(configContainer);
configSearcher.Filter = "(&(objectClass=addressBookContainer))";
configSearcher.PropertiesToLoad.Add("displayName");
configSearcher.PageSize = 10000;
configSearcher.SearchScope = SearchScope.Subtree;
SearchResultCollection results = configSearcher.FindAll();

Upvotes: 1

Related Questions