How to add the CrmService Web Reference for non-default CRM Organization or for CRM Live environment.

By | March 2, 2009

As a beginner in programming for Dynamics CRM but with knowledge of .NET, you would definitely like to first be able to add the CrmService Web Services Description Language (WSDL) to your Visual Studio project by using the URL of your Microsoft Dynamics CRM server.

CRM 4 additionally supports multi-tenancy and hence in the Enterprise edition of CRM you can have more than one Organization setup on your CRM server. While you could use the usual steps for adding a web-reference for the default Organization, if you need to pick up the customizations for a non-default organization you would need to follow the below steps.

These same steps need to be used when adding a reference for the CRM Live environment.

To obtain the Web reference for Microsoft Dynamics CRM Live you must first save a copy of the Web Services Description Language (WSDL) file to your development computer.

1. Open a Web browser and enter the URL for Microsoft Dynamics CRM Live. For example: https://demo.crm.dynamics.com/

2. Sign in using your Windows Live ID account.

3. In the Navigation pane, click Settings.

4. In the Settings pane, click Customization.

5. In the Customization area, click Download Web Service description files. 6. Click Download CrmService.asmx description (WSDL).

7. When the Web browser opens with the WSDL, save it as an XML file to the SDK\Bin folder or to your Visual Studio project folder. The procedure for saving the file will be different depending on the Web browser you are using. Also, the WSDL XML file can be saved to any convenient local location.

8. Open your Visual C# or Visual Basic .NET project in Microsoft Visual Studio. 9. In the Solution Explorer window, right-click your project name and choose Add Web Reference.

. In the Add Web Reference wizard, type the URL for the CrmService WSDL XML file that you previously downloaded into the URL box, and then click Go. For example:

C:\\CrmServiceWsdl.xml

11. When the CrmService Web service is found, change the text in the Web reference name box to Crmsdk and then click Add Reference.

The Microsoft Dynamics CRM Live Web service is now added to your project. In your source code you can refer to the classes available in this SDK.

Optionally, CRM SDK provides dll’s (Microsoft.Crm.Sdk and Microsoft.Crm.SdkTypeProxy) which can also be used for login and creating CRM service object.These assemblies contains types needed when you develop plug-ins and custom workflows. These assembly also includes the same set of entity classes, such as account class.

However, these are are template classes of default CRM install and the customizations of your organization cannot be found using this as can be through adding web reference of that organization as explained above. When working with entity instances, you should use the Microsoft.Crm.Sdk.DynamicEntity class. When you are using Dynamics Entity class it is possible to refer to any custom entity or custom attribute by setting the appropriate name to the Entity or Property.

Leave a Reply