Getting started with the CRM 2011 Windows Store app sample

UPDATE (18APR2013): Updated AuthenticateAsync() extension method to handle both IFD and CRM Online authentication.  Now, the code in HelloCRM will work regardless of whether you point it to an IFD or CRM Online Organization Service.  All you have to do is pass in the appropriate username/password combo to AuthenticateAsync().  Quick link to updated code:

UPDATE (12MAR2013): Found another issue with my helper extension methods around when I was detaching the event handler.  Uploaded a zip file with the improved helper methods.

UPDATE: There was a bug in my extension methods.  I wasn’t detaching the event handlers after the event had been handled.  This caused issues with subsequent calls to the Async extensions methods.  I’ve fixed the code to detach the event handlers appropriately.

I’ve blogged about a hackish, but workable approach to building an Windows Store app here and here.  However, as I mentioned in the post, if you like it use it.  If not wait until there’s an official SDK sample.  Well, in early November, the CRM time published the official SDK sample:

The feedback I’ve gotten from a few folks who’ve looked at the official sample is:

  • “It’s not exactly the easiest sample to follow.  Can you give me a hello world example?”
  • “I can’t use crmsvcutil.exe generated code with the sample.”
  • “I have to use Event-based Asynchronous Pattern (EAP)?  It’s Windows 8!  Everyone expects async / await capable APIs.”

The goal of this post is to address these common responses with:

  • A simplified hello world example to get you started
  • How to use crmsvcutil.exe generated entities so you have early bound / strongly typed / data binding friendly classes
  • Starter extension method examples which wrap the EAP nature of the sample API and give you async / await friendly methods



You can grab the hello world example from the video here:

In the video, I make reference to Erik Pool’s wonderful tool to control what gets generated from crmsvcutil.exe:

The inspiration for the Extension methods comes from this Stack Overflow post:

I blogged about using LINQPad to create FetchXml here:


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s