Share via


MailDisable Method

MailDisable Method

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.

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

Applies To

IMailRecipient Interface

Type Library

Microsoft CDO for Exchange Management Library

DLL Implemented In

CDOEXM.DLL

Syntax

[Visual Basic]Sub MailDisable
()

[C++]HRESULT MailDisable ();

Return Value

Returns S_OK if successful, or an error value otherwise.

Remarks

The MailDisable method clears all of the proxy addresses stored in ProxyAddresses Property, as well as SMTPEmail Property, X400Email Property and TargetAddress Property.

Example

The following example illustrates the MailDisable method using Collaboration Data Objects (CDO).

[Visual Basic]

Sub MailDisableCDOPerson(strFirstName As String, _ strLastName As String)

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

strUserName = strFirstName & strLastName

strContainerName = "Users"
' Create URL for the user
CreateUserURL(strURL, strContainerName, False, strUserName)

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.