Looking for a quick way to provide a user with a visual display to connect to CRM? Included in the CRM SDK and part of the Microsoft.Xrm.Client namespace is the Connection Dialog control that provides this functionality. To leverage this control, you’ll need to create a WPF client application. Here’s how:
1. Create a WPF application and add a button to the MainWindow.xaml file.
Fig 1: MainWindow.xaml file
2. Instantiate and display the ConnectionDialog class in the button’s click event.
Fig 2: MainWindow.xaml.cs file
3. The following is displayed to the user. The CRM Connection Dialog walks the user in gathering the required information needed to connect to CRM.
Fig 3: Discovery URL
Fig 4: User credentials
Fig 5: Available organization list
4. Once connected, the Connection Dialog will close and return control to the main application. You can inspect the ConnectionDialog object for a wealth of information such as the connection string, authentication type, organization selected and version.
And there you have it—a quick way to provide a visual display to allow a user to connect to CRM!