Navigation

Home

Developer Guides

Sample Code

Support

Integration Listings

Skip to end of metadata
Go to start of metadata

Introduction

This guide will serve as a reference for implementing Service Objects' Web Services with Microsoft CRM 2011. We will provide a brief background on Microsoft CRM 2011 Online as well as CRM 2011 server.

Resources

To simplify messaging to Microsoft CRM 2011 we recommend using the Microsoft Dynamics CRM 2011 SDK. The SDK provides proxy classes which simplify authentication, message, and error handling. In addition the SDK includes Sample Code for many different types of requests and functions covered in several languages ("C #, JS, VB"). To get started, there are several required libraries which may or not be available on your machine. Using the SDK assumes you will be working with Visual Studio 2010 in conjunction with .NET 4.0.

Download Microsoft Dynamics CRM 2011 SDK:
http://www.microsoft.com/download/en/details.aspx?id=24004

Download Microsoft Identity Foundation Library:
http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=17331

Getting Started

In creating a new project you will need to make sure that you are referencing the required libraries needed to successfully make requests to Microsoft Dynamics CRM 2011. After creating a project you should add a reference to the Microsoft CRM SDK Proxy DLL which should be located in your installed SDK's bin folder. You will also need to add a reference to Microsoft XRM SDK DLL also located in the installed SDK's bin folder. The following are the required system references that you will also need in your project:

Using the Helper Classes

The Microsoft Dynamics CRM 2011 SDK provides a library of helper classes which manage Server and Device properties for you. These classes can be found in the sdk/samplecode/<language>/helpercode directory. I recommend adding these classes into your project to simplify managing server client interaction. In building a sample console app I made use of the following helper classes:

Crmservicehelpers.cs
Deviceidmanager.cs
Myorganizationcrmsdktypes.cs
Optionsets.cs

Making the connection

To illustrate the basic workflow of interacting with the CRM server in conjunction with Service Objects' web services, I will construct a console application which extracts contacts, standardizes their addresses and updates the information back in to the CRM database. In the first steps, I instantiate a ServerConnection object which will then create a configuration file which is then stored locally as an xml file. This file will get referenced for future connections.

Retrieving Contacts from CRM 2011

Once a connection to the CRM server has been established, we can now begin retrieving contacts to update their respective data. The first step is to create a query which selects the desired Entity and attributes. For this we will use the QueryBase class to construct a new query. We will also need a collection type to store the results. I will use the EntityCollection class to store these results. Finally to retrieve all of the results I will use the RetrieveMultiple method from our service proxy to return all of the results.


Performing Contact Validation on an Entity Collection

Using the newly collected contacts it is now a simple matter of iterating through the collection to perform contact validation using one of the many services offered by Service Objects. For this example we will be standardizing the addresses from the CRM database. To generate the proxy classes used for interacting with Service Objects' Address Validation service, I have added a service reference to our trial server. I have also assigned an alias for the package reference to simplify using the service. You will also need a trial service license key to make calls to the Address Validation service which can be obtained at:

Trial License Key:
http://www.serviceobjects.com/lor?wsid=3&tmpl=component&task=preview&ml=1

Trial Server Path:
http://trial.serviceobjects.com/av/AddressValidate.asmx



Updating contacts in CRM 2011 Database

With the newly standardized data we can now proceed in updating the contacts in the CRM database. To do so we will iterate through the collection calling on the proxy service object we created in earlier examples and execute the Update method on each contact in the collection.

Download Sample Project

Sample Project used for this tutorial. AV2_MicrosoftCRM2011Integration.zip

Conclusion

In conclusion this design reference has provided a brief background on interacting with Microsoft Dynamics CRM 2011. We have covered the necessary resources needed to simplify connecting to your CRM server instance as well as manipulating the data within that instance.
For any topics not covered in this guide or to get assistance in implementing your solution with Service Objects' web services please feel free to contact us at support@serviceobjects.com

Labels
  • None