Platform SDK: Active Directory, ADSI, and Directory Services

Creating a Custom Recipient

Dim strDisplayname As String
Dim strAlias As String
Dim strTelephone As String
Dim objCont As IADsContainer
Dim objNewCR As IADs

strDisplayname = "James Smith"
strAlias = "jsmith"
strTelephone = "867-5309"

Set objCont = GetObject("LDAP://Server/cn=Recipients,ou=Site,o=Org")
Set objNewCR = objCont.Create("Remote-Address", CStr("cn=" & stralias))
objNewCR.Put "cn", CStr(strdisplayname)
objNewCR.Put "uid", CStr(stralias)
objNewCR.Put "telephoneNumber", CStr(strtelephone)
objNewCR.Put "Target-Address", "SMTP:jsmith@microsoft.com"
objNewCR.SetInfo

Note: This example is specific to Exchange Server version 5.5 and below, and is not upwardly compatible with Exchange 6.0. Management and access of Exchange 6.0 Servers should be made through the CDO Exchange Management interfaces instead.