Platform SDK: Exchange 2000 Server

MailDisable Method

[This is preliminary documentation and subject to change.]

This method disables mail to a recipient. The recipient can be a user, folder, contact or group.

[Visual Basic,VBScript]
Subroutine MailDisable()
[C++]
HRESULT MailDisable();
[IDL]
HRESULT MailDisable();

Remarks

MailDisable method clears all the proxy addresses, ProxyAddresses property, (including SMTPEMail, X400Email properties) and the TargetAddress property.

Example (CDO)

[Visual Basic]
Function CDODisable_Recipient(ServerName As String, _
                              DomainName As String, _
                              recipname As String) As Integer

'ServerName is something like "MyServer6"
'DomainName is something like "DC=MYDOMAIN3,DC=microsoft,DC=com"
'recipname is is the email alias eg. "jamessmith"

    Dim objPerson As New CDO.Person
    Dim objRecip As CDOEXM.IMailRecipient
    Dim forward_email As String
    
    On Error GoTo Error
    
    objPerson.DataSource.Open "LDAP://" + ServerName + _
                                "/CN=" + recipname + _
                                ",CN=users," + DomainName
    
    Set objRecip = objPerson
    
    If (objRecip.TargetAddress <> "") Or (objRecip.X400Email <> "") Then
       objRecip.MailDisable
       objPerson.DataSource.Save
       MsgBox recipname + " mail disabled"
    End If
       
    
    GoTo Ending
    
Error:
    If Err.number = -2147016656 Then
       MsgBox recipname + " not found."
       Err.Clear
    Else
       MsgBox "Run time error: " + Str(Err.number) + " " + Err.Description
       Err.Clear
    End If
       
Ending:
End Function