MSDN Magazine Launch Issue - February 15, 2008 - (Page 37) and how you can utilize these transports and tools in your mobile applications. Mail Transports The .NET Compact Framework 3.5 includes WindowsMobileMailTransport for messaging on the Windows Mobile platform and ExchangeWebServiceMailTransport for messaging on the Windows desktop platform. The two transports interoperate so that communication among devices, among PCs, or between devices and PCs all works transparently. Since many applications may be using the mail transport at the same time for the same recipient, a mail channel name can be given to distinguish messages intended for your application from messages intended for other applications. This channel name is then included in the subject line of each message. As a result, the mail transport will only open mes- Figure 1 Setting Up Your Project sages with the subject name that corresponds Make sure you have Windows Mobile Device Center 6.1 or to the channel name for which you are listening. The mail transport for Windows Mobile devices that ships with ActiveSync® 4.5 installed before you begin. You can download these the .NET Compact Framework 3.5 performs best if running on a from microsoft.com/activesync. If you’re running Windows Vista®, the easiest way to set up mail Windows Mobile device that supports DirectPush, a feature that enables the associated Exchange server to push messages to Windows on your emulator is to open up the Device Emulator Manager and Mobile as soon as Exchange receives the message. To learn more cradle the emulator. Windows Mobile Device Center (WMDC) about DirectPush (also known as Always-Up-To-Date) or to in- should open when the device connects. If WMDC is installed but stall it on your Windows Mobile device, visit msexchangeteam.com/ does not recognize a cradled emulator, use the Start menu to launch WMDC. Under Mobile Device Settings, check the Connection archive/2004/04/26/120520.aspx. If you are familiar with Microsoft Message Queuing (MSMQ), Settings and make sure that mail transport is very similar, except that it does not have the prob- “Allow connections to one The mail transport for lem of device addressability. The mail stores on the device and on of the following:” is checked Windows Mobile performs the Exchange server act as the message queues. The e-mail addresses and that DMA is selected in the dropdown. of each device and server act as the queue’s URI. best if running on a device Click “Set up your deNote that while, theoretically, two devices using Windowsthat supports DirectPush. MobileMailTransport may be able to use any SMTP/POP3 serv- vice” and keep at least the ers to communicate, the only scenario that is currently supported E-mail option checked. in the .NET Compact Framework 3.5 uses Exchange Server 2007 Then, go ahead and provide the information to allow the device as the mail server. Additionally, custom Windows CE devices are (or emulator) to connect directly to Exchange. This will allow your program to send and receive messages whenever there is a network not supported. To illustrate how the transports operate, I’m going to build a pair available—even when it is not cradled. Finish setting up the partof small sample apps and use e-mail to send instant message-like nership with the device or emulator. If you decide to make use of the mail transport using your permessages between a Windows Mobile device and a PC. The mail transports only support one-way messaging (as opposed to request- sonal e-mail address, you may choose to set up an Exchange Rule to redirect all messages with a subject line starting with “SM”: to reply), which is good for an instant message app. The first two actions you should take are to install Visual Studio another folder. The .NET Compact Framework 3.5 mail trans2008 and to decide on your target device. This target device, wheth- ports will only check two folders for WCF messages, Inbox and er physical or emulated, will need to be configured to access your Service E-Mail, so be sure to keep your WCF messages in one of Exchange Server 2007 mail account. Be sure to do this before you these two folders. test your app. If you configure an emulated device, either leave it running or save its state before closing it—otherwise, it will revert to Writing a Windows Mobile App You start writing a Windows Mobile application by creating a Visual not having a mail account setup. If you forget, you’ll probably find C#® Smart Device project. Name the project DeviceMessagingApp messages piling up in your device’s outbox with nowhere to go. launch2008 37 http://microsoft.com/activesync http://msexchangeteam.com/archive/2004/04/26/120520.aspx http://msexchangeteam.com/archive/2004/04/26/120520.aspx
For optimal viewing of this digital publication, please enable JavaScript and then refresh the page. If you would like to try to load the digital publication without using Flash Player detection, please click here.