Share via


MailSecurity.Mode Property

[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]

Gets or sets the channel security for the mail binding.

Namespace:  Microsoft.ServiceModel.Channels.Mail
Assembly:  Microsoft.ServiceModel.Channels.Mail (in Microsoft.ServiceModel.Channels.Mail.dll)

Syntax

'Declaration
Public Property Mode As MailSecurityMode
    Get
    Set
'Usage
Dim instance As MailSecurity
Dim value As MailSecurityMode

value = instance.Mode

instance.Mode = value
public MailSecurityMode Mode { get; set; }
public:
property MailSecurityMode Mode {
    MailSecurityMode get ();
    void set (MailSecurityMode value);
}
member Mode : MailSecurityMode with get, set

Property Value

Type: Microsoft.ServiceModel.Channels.Mail.MailSecurityMode
One of the enumeration values that represents the channel security for the mail binding.

Exceptions

Exception Condition
ArgumentOutOfRangeException

The MailSecurityMode enumeration is set to a value that is not supported.

Remarks

The default value is MailSecurityMode.None, which indicates that SOAP message security is disabled.

Examples

The following example shows how to enable message security for the mail binding. For the complete code example, see the MailSecurity class.

Dim binding As ExchangeWebServiceMailBinding
Dim clientEmailServer As New Uri("https://mail.example.com")
Dim clientEmailAddress As String = "client@example.com"
Dim password As String = "password"

binding = New ExchangeWebServiceMailBinding(clientEmailServer, New NetworkCredential(clientEmailAddress, password))
binding.Security.Mode = MailSecurityMode.Message
ExchangeWebServiceMailBinding binding;
Uri clientEmailServer = new Uri("https://mail.example.com");
string clientEmailAddress = "client@example.com";
string password = "password";

binding = new ExchangeWebServiceMailBinding(clientEmailServer,
                                           new NetworkCredential(clientEmailAddress, password));
binding.Security.Mode = MailSecurityMode.Message;

.NET Framework Security

Platforms

Windows CE, Windows Mobile for Smartphone, Windows Mobile for Pocket PC

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Version Information

.NET Compact Framework

Supported in: 3.5

See Also

Reference

MailSecurity Class

MailSecurity Members

Microsoft.ServiceModel.Channels.Mail Namespace