Featured Post

Web API Requests Series

Web API Series:  Create and Retrieve , Update and Delete , Retrieve Multiple , Associate/Disassociate , Impersonation , Run Workflows

30 May 2011

How to use the CSDL file generated by the REST endpoint with Silverlight.

In this walk through, I will walk you through the steps needed to download the CSDL file that the REST endpoint generates based on the entities available to your development organization. Later we will see how to create a WCF data service based on the CSDL file.


N.B. Only those entities that are present when you generate the classes will be available for the Silverlight application.
Steps:

  1. In CRM 2011 navigate to Settings. Choose Customizations and then Developer Resources.
  2. Under Service Endpoints, click the Download CSDL link and save the OrganizationData.csdl file to your computer.


Now that we have our file generated and downloaded to our computer, we can use it to create a WCF data service, so from Visual Studio:
  1. In your Visual Studio Silverlight application project, right-click References, and then click Add Service Reference.
  2. Type the path of the location where you saved the OrganizationData.csdl file, and then click Go.
  3. Enter an appropriate Namespace and then click OK.
The name of the System.Data.Services.Client context will be "YourOrganizationNameContext".

Well done! Now we have our Silverlight application all set up ready to access the entities in our CRM organization. In another post I will show how to use the REST endpoint with Silverlight.
Stay tuned!

No comments:

Post a Comment