Setting up the Web Services

banner art

To access the classes and methods available from the Microsoft CRM Web services, you need to add a Web reference for each required Web service to your project. The following Web services are needed for development with this SDK:

http://<servername[:port]>/mscrmservices/2006/crmservice.asmx
http://<servername[:port]>/mscrmservices/2006/metadataservice.asmx

In most cases, a Web reference to crmservice.asmx is needed. If your code accesses Microsoft CRM metadata, then a Web reference to metadataservice.asmx is also needed. Consult the Programming Reference section of the Server Programming Guide for a complete description of the classes and methods that are available from each Web service.

The TCP port number in the Web service Url is optional and only required if Microsoft CRM is installed to a non-default Web site on the server. For example:

http://localhost:5555/mscrmservices/2006/crmservice.asmx 

The TCP port used by the Microsoft CRM Web site can be obtained from your server's Administrator or by viewing the Microsoft CRM Web site properties using the Internet Information Services (IIS) Manager administrative tool.

If Microsoft CRM is installed to the default Web site on the server, the Url is:

http://localhost/mscrmservices/2006/crmservice.asmx

In the above examples, replace the server name with the name, and optionally the domain, of the target Microsoft CRM server.

Adding a Web Reference In Visual Studio

  1. Create a C# or VB .NET project in Microsoft Visual Studio.
  2. In the Solution Expolorer pane, right click References.
  3. Choose Add Web Reference.
  4. In the URL field, paste the following string, replacing <your server name> with the name of your Microsoft CRM Server.
    http://<your server name>/mscrmservices/2006/crmservice.asmx
  5. Click Go.
  6. Edit the Web reference name. This is the name you will put in the Using statement in your source code. For this example enter CrmSdk.
  7. Click Add Reference.

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

Example

using System;
using MyProject.CrmSdk;

namespace MyProject
{
   public class Class1
   {
      public Class1()
      {
         CrmService service = new CrmService();

         account myAccount = new account();
         myAccount.accountnumber = "1234";
      }
   }
}

© 2007 Microsoft Corporation. All rights reserved.


Show: