I got my hands dirty with ActiveSync two weeks back (http://mobilitydojo.net/2010/03/17/digging-into-the-exchange-activesync-protocol), and shared the results with you here. I also mentioned that doing the things I did required a few lines of code since not everything could be done in Fiddler. Because of this I promised you I had something in the works to let you actually play around too, without cracking open your Visual Studio, and now I’m trying to make good on this promise
I introduce to you, the first beta release of “Exchange ActiveSync MD”. It is a desktop app that will let you emulate a device connecting to ActiveSync. Yes, it is similar to what www.testexchangeconnectivity.com, but I only focus on EAS, and I have a couple of options not present in the ActiveSync test MSFT provide. It will require you to have .Net 3.5 installed on your computer – I’ve tested it running on Windows 7 and Windows Server 2008 R2, but it should work on other Windows versions too with .Net present. It will not require an installation, and you can just run the .exe file itself.
It has only three screens to relate to, and while most of it is fairly self-explanatory, (doesn’t always the programmer believe this to be the fact?), I’ll walk you through it:
Main

This would be the place you’ll be finding yourself in most of the time using this simple app. There are two tests you can perform; “Basic Connectivity” and “Full Sync”.
Basic Connectivity: for this test you will need to provide the connection parameters, but you can ignore the other options and parameters. This test will perform a HTTP GET against the specified server address to pinpoint basic issues like DNS resolution, server being reachable, and authentication. If the GET works you’ll get a 501/505 the same way as opening the address in a browser. If the GET goes through a HTTP OPTIONS is done against the server to pull down info like server version, etc.
Full Sync:
You still need to fill out the connection parameters, but there are default values provided for the other options. (The connection will be made at the Exchange 2007 RTM level if nothing else is specified in MS-ASProtocolVersion.) The program will attempt the FolderSync command, and provide response based on the security polices in effect on the server. You will be informed in the output window if the sync didn’t go through for some reason, and a tip for correcting it.
For Device ID, Device Type & User Agent you can specify whatever you like as long as you’re not using the new features in Exchange 2010 for restricting these parameters.
The “Device Properties” are additional attributes you might need to set for the sync to go through.
The output window has switches for binary, hex, and base64. Most likely you’re not going to need them all that often. (This only applies to the response body, other text and headers are in plain old text format.) I had to use it for some debugging purposes since the wbxml isn’t all that easy to read.
Certificate Info

While you can ignore any certificates issues on the previous tab it can be very handy to pull down the chain and see why it fails if you weren’t expecting it to fail. You don’t need to provide any credentials – just point it to a server running SSL (on port 443). The app then establishes a socket connection and pulls down the chain. Some basic info is printed out, and at the bottom the certificates themselves are embedded in base64. This means that you can open up your Notepad, paste in the string, and save the file with the extension .cer and you will have a certificate file you can use. I am aware I could have provided a possibility for provisioning it directly into a certificate store, but that felt like more work than it was worth
I could also have pulled all the certs into a single p7b format, but.. well, it works the way it should and serves my purposes in it’s present form. Let me know if there is something that is missing from this tab in the feature department.
Base64 Utility

I often find my self needing to convert between a base64 string and plain text when testing, so I just included a tab for it in this app. You might not need it that often, but it’s convenient to have easily accessible.
So does it actually work then? I’ve tested against Exchange 2007 SP1/SP2, and Exchange 2010. No Exchange 2007 RTM unfortunately (even if it’s a choice on the list), and Exchange 2003 is not on the supported list yet. (Of course you can test all client versions against the latest server version since Exchange is backwards compatible.) I believe I have tested the different combos of enforcing policies and blocking non-provisionable but there are differences between each AS-version so I cannot guarantee at this time that there’s not some sneaky bug somewhere. (It is a beta for a reason you know.)
I’m also aware that the interface looks kinda “not done by an actual designer”, and while I do like creating 3D graphics and related stuff I never was top-notch at creating user interfaces
There are two known issues I haven’t solved at the present time:
- If you turn on “Trust all certificates”, and then uncheck it you’ll still be trusting all certificates. Workaround is to close the program, and re-start.
- If you have a username and/or password with special characters it might not encode properly, and thus you’ll get a 401 returned.
I am aware of these issues, and will try fixing them. The issues I am not aware will be fixed later on.
While not a bug as such, the internals doesn’t exactly conform to what could be considered “beautiful code”, but that might not be the most important thing at the moment I guess
(Obviously in the process of cleaning the code, maybe I come across a line that need to be fixed up to so it serves a purpose too.)
My first focus is to do some additional testing, and making sure everything works as advertised. The second priority, which is more fun obviously, is adding new features. How many features could you cram into a small utility like this you say? Technically you can implement a fully featured ActiveSync client, and while I’m not going to do that the next weeks I am investigating if I can implement wbxml parsing. No promises yet though.
In the meantime, test it out, see if it’s useful, and let me know if you have any questions or feedback.
Download: http://mobilitydojo.net/downloads/ (Sends you to the download page so you can fetch the latest release.)