Sample: Simplified Connection Quick Start using Microsoft Dynamics CRM

[Applies to: Microsoft Dynamics CRM 2011]

The Simplified Connection QuickStart sample is a Microsoft .NET Framework managed code sample that shows how to connect to the Microsoft Dynamics CRM 2011 web services using the CrmConnection class and perform basic create, update, retrieve, and delete operations on an entity. For more information about the CrmConnection class, see Simplified Connection to Microsoft Dynamics CRM in Developer Extensions for Microsoft Dynamics CRM.

Requirements

This sample code is for Microsoft Dynamics CRM 2011, and can be found in the following location in the SDK download:

SDK\SampleCode\CS\QuickStart\SimplifiedConnection.cs

SDK\SampleCode\VB\QuickStart\SimplifiedConnection.vb

You must modify the supplied app.config file with connection information for your Microsoft Dynamics CRM server before you run the sample. For more information, see Simplified Connection to Microsoft Dynamics CRM and the commented out example connection strings in the app.config file.

Demonstrates

This sample authenticates the user with the Microsoft Dynamics CRM web services by using the CrmConnection class and methods. After obtaining a reference to the Organization web service, the sample performs basic create, update, retrieve, and delete operations on an account entity. The sample also handles common exceptions. No helper code is used to establish a connection to the Organization web service.

Example

A sample app.config file. You must uncomment the <add … /> line that is relevant to your server and organization. Next, modify the attribute values as appropriate for your configuration.

<?xml version="1.0"?>
<configuration>
  <connectionStrings>
    <!-- Online using Office 365 -->
    <!-- <add name="Server=CRM Online, organization=contoso, user=someone"
         connectionString="Url=https://contoso.crm.dynamics.com; Username=someone@contoso.onmicrosoft.com; Password=password;"/> -->

    <!-- Online using Microsoft account (formerly Windows Live ID) -->
    <!-- <add name="Server=CRM Online, organization=contoso, user=someone@example.com"
         connectionString="Url=https://contoso.crm.dynamics.com; Username=someone@example.com; Password=password; DeviceID=11hfn41bbqrg580vyvoea05abc; DevicePassword=fuqNIlx%e$.l*+ax_#8O4abc;"/>-->
    
    <!-- On-premises with provided user credentials -->
    <!-- <add name="Server=myserver, organization=AdventureWorksCycle, user=administrator"
         connectionString="Url=http://myserver/AdventureWorksCycle; Domain=mydomain; Username=administrator; Password=password;"/> -->

    <!-- On-premises using Windows integrated security -->
    <!--<add name="Server=myserver, organization=AdventureWorksCycle"
         connectionString="Url=http://myserver/AdventureWorksCycle;"/>-->

    <!-- On-premises (IFD) with claims -->
    <!--<add name="Server=litware.com, organization=contoso, user=someone@litware.com"
         connectionString="Url=https://contoso.litware.com; Username=someone@litware.com; Password=password;"/>-->
  </connectionStrings>
  <startup>
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
  </startup>
</configuration>
No code example is currently available or this language may not be supported.

See Also

Microsoft Dynamics CRM 2011
Send comments about this topic to Microsoft.
© 2013 Microsoft Corporation. All rights reserved.

Community Additions

ADD
Show: