WindowsMobileMailTransportBindingElement 클래스
업데이트: 2007년 11월
Windows Mobile 탑재 장치에 대한 메일 전송 바인딩 요소를 나타냅니다.
네임스페이스: Microsoft.ServiceModel.Channels.Mail.WindowsMobile
어셈블리: Microsoft.ServiceModel.Channels.Mail.WindowsMobile(Microsoft.ServiceModel.Channels.Mail.WindowsMobile.dll)
구문
‘선언
Public NotInheritable Class WindowsMobileMailTransportBindingElement _
Inherits MailTransportBindingElementBase
‘사용 방법
Dim instance As WindowsMobileMailTransportBindingElement
public sealed class WindowsMobileMailTransportBindingElement : MailTransportBindingElementBase
public ref class WindowsMobileMailTransportBindingElement sealed : public MailTransportBindingElementBase
public final class WindowsMobileMailTransportBindingElement extends MailTransportBindingElementBase
설명
WindowsMobileMailTransportBindingElement는 Windows Mobile 탑재 장치에서 메일 전송을 구성하는 데 사용되는 메일 전송 바인딩 요소를 나타내는 봉인 클래스입니다. 이러한 메일 전송을 통해 Exchange 서버(Microsoft Exchange Server를 실행하는 서버)와 메시지를 동기화할 수 있습니다.
기본 클래스인 MailTransportBindingElementBase에는 이 클래스에서 사용하는 대부분의 기능이 포함되어 있습니다.
이 클래스의 새 인스턴스를 초기화한 후 해당 개체를 새 CustomBinding 개체의 생성자에 인수로 전달하십시오.
예제
다음 예제에서는 WindowsMobileMailTransportBindingElement 클래스를 사용하는 방법을 보여 줍니다. 여기에서는 사용자 지정 인코딩 요소를 사용하여 CustomBinding 개체를 만듭니다.
Class Program
Private Shared ChannelName As String = "Channel1"
Private Shared DestinationEmailAddress As String = "someone@example.com"
Private Shared serializer As New CFMessagingSerializer(GetType(String))
Shared Sub Main(ByVal args() As String)
Dim factory As IChannelFactory(Of IOutputChannel)
Dim listener As IChannelListener(Of IInputChannel)
Dim output As IOutputChannel
Dim input As IInputChannel
Dim bpc As BindingParameterCollection
Dim mailTransportBindingElement As MailTransportBindingElementBase
Dim msgEncodingBindingElement As MessageEncodingBindingElement
Dim message As Message
Dim str As String
Dim binding As System.ServiceModel.Channels.Binding
' Instantiate a TextMessageEncodingBindingElement or
' a custom encoding binding element. If you use a custom encoding
' binding element, messages must be sent as attachments.
msgEncodingBindingElement = New CustomMessageEncodingBindingElement()
mailTransportBindingElement = New WindowsMobileMailTransportBindingElement()
mailTransportBindingElement.MessageContainerType = MessageContainerType.Attachment
' In this example, set lifetime to 1 day, 10 hours,
' 20 minutes, and 30 seconds.
mailTransportBindingElement.TimeToLive = New TimeSpan(1, 10, 20, 30)
mailTransportBindingElement.Transport.MaxTotalMessageCacheSize = 1000
binding = New CustomBinding(msgEncodingBindingElement, mailTransportBindingElement)
bpc = New BindingParameterCollection()
factory = binding.BuildChannelFactory(Of IOutputChannel)(bpc)
listener = binding.BuildChannelListener(Of IInputChannel)(MailUriHelper.CreateUri(ChannelName, ""))
factory.Open()
output = factory.CreateChannel(New EndpointAddress(MailUriHelper.Create(ChannelName, DestinationEmailAddress)))
output.Open()
message = System.ServiceModel.Channels.Message.CreateMessage(MessageVersion.Default, "urn:Test", "Hello, World!", serializer)
output.Send(message)
output.Close()
factory.Close()
listener.Open()
input = listener.AcceptChannel()
input.Open()
message = input.Receive()
str = message.GetBody(Of String)(serializer)
MessageBox.Show(str, "Received message")
input.Close()
listener.Close()
mailTransportBindingElement.Close()
End Sub
End Class
class Program
{
private static string ChannelName = "Channel1";
private static string DestinationEmailAddress = "someone@example.com";
private static CFMessagingSerializer serializer = new CFMessagingSerializer(typeof(string));
static void Main(string[] args)
{
IChannelFactory<IOutputChannel> factory;
IChannelListener<IInputChannel> listener;
IOutputChannel output;
IInputChannel input;
BindingParameterCollection bpc;
MailTransportBindingElementBase mailTransportBindingElement;
MessageEncodingBindingElement msgEncodingBindingElement;
Message message;
string str;
System.ServiceModel.Channels.Binding binding;
// Instantiate a TextMessageEncodingBindingElement or
// a custom encoding binding element. If you use a custom encoding
// binding element, messages must be sent as attachments.
msgEncodingBindingElement = new CustomMessageEncodingBindingElement();
mailTransportBindingElement = new WindowsMobileMailTransportBindingElement();
mailTransportBindingElement.MessageContainerType = MessageContainerType.Attachment;
// In this example, set lifetime to 1 day, 10 hours,
// 20 minutes, and 30 seconds.
mailTransportBindingElement.TimeToLive = new TimeSpan(1, 10, 20, 30);
mailTransportBindingElement.Transport.MaxTotalMessageCacheSize = 1000;
binding = new CustomBinding(msgEncodingBindingElement, mailTransportBindingElement);
bpc = new BindingParameterCollection();
factory = binding.BuildChannelFactory<IOutputChannel>(bpc);
listener = binding.BuildChannelListener<IInputChannel>(MailUriHelper.CreateUri(ChannelName, ""), bpc);
factory.Open();
output = factory.CreateChannel(new EndpointAddress(MailUriHelper.Create(ChannelName, DestinationEmailAddress)));
output.Open();
message = Message.CreateMessage(MessageVersion.Default, "urn:Test", "Hello, World!", serializer);
output.Send(message);
output.Close();
factory.Close();
listener.Open();
input = listener.AcceptChannel();
input.Open();
message = input.Receive();
str = message.GetBody<string>(serializer);
MessageBox.Show(str, "Received message");
input.Close();
listener.Close();
mailTransportBindingElement.Close();
}
}
상속 계층 구조
System.Object
System.ServiceModel.Channels.BindingElement
System.ServiceModel.Channels.TransportBindingElement
Microsoft.ServiceModel.Channels.Mail.MailTransportBindingElementBase
Microsoft.ServiceModel.Channels.Mail.WindowsMobile.WindowsMobileMailTransportBindingElement
스레드로부터의 안전성
이 형식의 모든 공용 static(Visual Basic의 경우 Shared) 멤버는 스레드로부터 안전합니다. 인터페이스 멤버는 스레드로부터 안전하지 않습니다.
플랫폼
Windows CE, Windows Mobile for Smartphone, Windows Mobile for Pocket PC
.NET Framework 및 .NET Compact Framework에서 모든 플랫폼의 전체 버전을 지원하지는 않습니다. 지원되는 버전의 목록을 보려면 .NET Framework 시스템 요구 사항을 참조하십시오.
버전 정보
.NET Compact Framework
3.5에서 지원