Share via


Disabling a Mail Recipient

Disabling a Mail Recipient

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.

Call the IMailRecipient.MailDisable method to disable a mail recipient. The IMailRecipient interface is aggregated onto the Person object.

Example

The example uses the CreateUserURL function, which is described in the topic Creating a User URL.

Visual Basic

Sub MailDisableCDOPerson(strUserName As String, strDomain As String)

    Dim oPerson         As New CDO.Person
    Dim oRecipient      As CDOEXM.IMailRecipient
    Dim strURL          As String

    ' Create URL for the user
    strURL = "LDAP://CN=" + strUserName + ",CN=Users," + strDomain

    Set oPerson = New CDO.Person
    ' Bind
    oPerson.DataSource.Open strURL

    ' MailDisable
    Set oRecipient = oPerson
    oRecipient.MailDisable

    ' Save
    oPerson.DataSource.Save

    'CleanUp
    Set oPerson = Nothing
    Set oRecipient = Nothing

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.