Share via


Setting Proxy Addresses

Setting Proxy Addresses

This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release.

Example

This example sets the proxy addresses for a mailbox-enabled user. When setting proxy addresses, you must specify a default proxy address by using all capital letters in one address. In the following example, the "X400" address is designated as the default proxy address.

Visual Basic

Sub SetProxyAddress(recipname As String, _
                    DomainName As String)

    'DomainName is something like "DC=MYDOMAIN3,DC=example,DC=com"
    'recipname is something like "jamessmith"

    Dim objPerson As New CDO.Person
    Dim objMailRecip As CDOEXM.IMailRecipient
    Dim i

    objPerson.DataSource.Open "LDAP://CN=" + recipname + _
                              ",CN=users," + DomainName


    'Capitalized proxy type for proxies(1) makes it the primary (reply) address.
    'the others are receive only.
    Dim proxies(3) As Variant
    proxies(0) = "smtp:user@secondarymailproxy.example.com"
    proxies(1) = "SMTP:user@primarymailproxy.example.com"
    proxies(2) = "X400:c=us;a= ;p=Domain;o=First Organization;s=user;"

    Set objMailRecip = objPerson
    objMailRecip.ProxyAddresses = proxies

    'look at the results
    Debug.Print Chr(13) + Chr(13) + Chr(13) + Chr(13) + Chr(13) 'add some space
    For i = LBound(objMailRecip.ProxyAddresses) To UBound(objMailRecip.ProxyAddresses)
      Debug.Print objMailRecip.ProxyAddresses(i)
    Next

    objPerson.DataSource.Save
    MsgBox "Proxy addresses for " + recipname + " set successfully"

End Sub

Send us your feedback about the Microsoft Exchange Server 2003 SDK.

Build: June 2007 (2007.618.1)

© 2003-2006 Microsoft Corporation. All rights reserved. Terms of use.