Article ID: 251390 - Last Review: September 28, 2007 - Revision: 5.2 How to find Exchange recipients that are associated with an NT accountThis article was previously published under Q251390 On This PageSUMMARY
The sample code in this article uses Active Directory Services Interfaces (ADSI) along with a resource kit object from the Platform SDK to find all of the mailboxes linked to a particular Windows Domain account. A Microsoft Exchange Server recipient may have a primary Windows Domain account associated with it. Since it is most common to associate a Windows Domain account with a mailbox, this article refers to the recipient as such. However, it is worth noting that a Windows Domain account can be linked with a custom recipient as well. In both cases, this link is created by storing the security identifier (SID) of the Windows Domain account in an attribute on the object in the directory. Find recipients that are associated with an NT accountADSI has a Lightweight Directory Access Protocol (LDAP) provider that can be used to retrieve information from the Exchange directory. The mailbox attribute which stores the Primary Windows Domain account has an LDAP name of Assoc-NT-Account. The Assoc-NT-Account attribute does not contain the security account's textual name, but rather a binary string representation of the SID. Every object in the Windows NT Security Domain has an SID. Also, most of the objects, such as Windows NT user accounts, have names that can be displayed as MyDomain\MyUserName.The example below takes the domain and username of a Windows Domain account as inputs. It retrieves the SID for that account from the primary domain controller as an array of bytes. Next, it converts the binary array into the string representation format that the SID is stored in by Exchange. Finally, the example queries Exchange for all Assoc-NT-Account attributes with that value and displays them. The code below requires that both the ADSI run time and the ADsSecurity.dll file are properly installed on the system. The ADsSID class of the ADsSecurity object is used to retrieve the SID and covert it into the string representation. This process could be done in an application without the use of this object. However, it is included here so that the example can be used in a scripting environment. REFERENCESFor more information about operating system-specific ADSI run-time downloads, visit the following Microsoft Web site: http://msdn2.microsoft.com/library/aa772170.aspx
(http://msdn2.microsoft.com/library/aa772170.aspx)
For more information ADSI ADO provider, click the following article number to view the article in the Microsoft Knowledge Base:
187529
(http://support.microsoft.com/kb/187529/
)
How to use ADO to access objects through an ADSI LDAP provider
The ADsSecurity.dll file is part of Active Directory Service Interfaces (ADSI) software development kit (SDK) 2.5.To download ADSI SDK 2.5, visit the following Microsoft Web site: http://www.microsoft.com/technet/archive/winntas/downloads/adsi25.mspx?mfr=true
(http://www.microsoft.com/technet/archive/winntas/downloads/adsi25.mspx?mfr=true)
APPLIES TO
| Article Translations
|

Back to the top
