TransportDemo sample in Pocket PC 5.0 SDK does not work? Check the solution here...
====>SiteMap of this Blog<===
TransportDemo sample in Pocket PC 5.0 SDK does not work? Check the solution here...
I am going to start a new category "Outlook and MAPI related". I have been developing a customized mail transport for Pocket Outlook for quite some time, and have programmed MAPI extensively.
A good start to learn how to write a customized mail transport is to read the TransportDemo sample shipped in both Windows Mobile 2003 SDK and Windows Mobile 5.0 SDK. It gives the reader good heads-up what important methods to implement (IMailSyncHandler), what to export in the transport DLL (OneStopFactory), and how to register the transport in registry. The sample does not really synchronize a mail account, nor does it send outgoing emails. And, the sample does not show how to programmatically provision a new mail account based on the customized transport (a possible new blog post here?); rather, it anticipates the reader to manually create one via Pocket Outlook's New Account Wizard.
With all the above being said, I found that I could not create a new account in Pocket PC 5.0 emulator. I tried both manual creation using Outlook's New Account Wizard, and programmatic way using DMProcessConfigXML. The account simply does not show up. Soon I realized the account WAS created, but was NOT listed in Outlook, based on the following three reasons:
- Since I had already worked on a customized transport in Pocket PC 2003 and Smartphone 2003 for quite some time, I was pretty sure that I built the DLL and registered the transport in the registry correctly.
- Further, the account must already have been created, as I could not created a second one with the same name.
- Further, I could easily query back the account information using DMProcessConfigXML.
A quick google group search reveals three fellow victims:
- Custom transports for PPC2005 Inbox.
- Tansportdemo sample can's create a account in Inbox
- Programmatically create an Inbox Account
None of them found the solution. So I was on my own here. Why the account was created but could not be displayed? Could it be caused by the fact that I did not sign the DLL, as Pocket PC 5.0 is most probably a "one-tier-prompt" device (security-related, another big category in my mind)? Soon I dismissed this possibility. I tried two methods to rule out the security concern. First method was to sign the DLL using the SDK privileged certificate ("SDKSamplePrivDeveloper.pfx"), and load the certificate to the emulator (how? a possible new blog post). Second method was to disable security settings in the emulator (how? a possible new blog post). In both cases, the account simply refused to show up.
In despair, I wrote a small program to load my own DLL and call the function "OneStopFactory". Arrrr... LoadLibrary() failed!! Till this point, I knew the reason: Certain DLLs must be missing in the emulator. After running depends.exe (although in my desktop PC, but still emitted some traces), I found that "msvcr80d.dll" is required. So I copied it from my desktop ("C:\Program Files\Microsoft Visual Studio 8\VC\ce\Dll\armv4i") to the Pocket PC 5.0 emulator. Upon restarting Pocket Outlook, all previously-created accounts showed up.