Skip to main content


Showing posts from June, 2011

CRM 2011 ConnectionDialog

The CRM 2011 SDK contains a really helpful way to connect to CRM using the variety of connection types that CRM offers.

This hidden gem is a WPF control called ConnectionDialog and it can be found in the Microsoft.Xrm.Client.dll.  The SDK lists the ConnectionDialog class but it doesn't contain any examples of how to implement it so I'm providing the code I used to get it to work.

First I create the ConnectionDialog and then Activate it so it will bring the window to the foreground:

            ConnectionDialog dialog = new ConnectionDialog();

Then you can either show the window modeless or modal.  I chose to show it as modal and capture whether the User cancelled out without entering connection information:

            var result = dialog.ShowDialog();
            if (result == true)

If the User completed the connection wizard then the result will be set to true and then we can use the ConnectionString on the dialog …