다음을 통해 공유


MailBindingBase.TimeToLive Property

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

Gets or sets a structure that determines the lifetime of messages sent on the output channel created for this binding.

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

Syntax

'Declaration
Public Property TimeToLive As TimeSpan
    Get
    Set
'Usage
Dim instance As MailBindingBase
Dim value As TimeSpan

value = instance.TimeToLive

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

Property Value

Type: System.TimeSpan
A structure that determines the lifetime of messages sent on the output channel created for this binding.

Exceptions

Exception Condition
ArgumentOutOfRangeException

TimeToLive is less than TimeSpan.Zero.

Remarks

The value of this property is added to the time that the message was created by the output channel, and the result is stored in the message class. If the destination transport receives the message after the lifetime has elapsed, the message is deleted and is not sent to the application.

Examples

The following example shows how to use the TimeToLive property. It uses a TimeSpan constructor that enables you to specify the lifetime of the message in days, hours, minutes, and seconds.

' For a desktop application, use ExchangeWebServiceMailBinding.
binding = New WindowsMobileMailBinding()

binding.MinimumAttachmentSize = 1024
' Set lifetime to 1 day, 10 hours, 20 minutes, and 30 seconds.
binding.TimeToLive = New TimeSpan(1, 10, 20, 30)
// For a desktop application, use ExchangeWebServiceMailBinding.
binding = new WindowsMobileMailBinding();

binding.MinimumAttachmentSize = 1024;
// Set lifetime to 1 day, 10 hours, 20 minutes, and 30 seconds.
binding.TimeToLive = new TimeSpan(1, 10, 20, 30);

.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

MailBindingBase Class

MailBindingBase Members

Microsoft.ServiceModel.Channels.Mail Namespace