Muokkaa

Jaa


Run a simple program using Customer Engagement web services

This topic shows you how to compile and run a program that creates an account record, retrieves the record, updates the record, and then prompts to see if you would like the record deleted.

Prerequisites

Compile and run the Quick Start sample

  1. Extract the downloaded file and open the \C#\QuickStart.csproj

  2. Open the \C#\QuickStart.csproj file in Visual Studio.

  3. Right click the QuickStart project in the solution explorer and select Manage NuGet Packages...

  4. Select the Microsoft.CrmSdk.CoreAssemblies package and update to the latest stable version.

  5. Press F5 to compile and run the program.

  6. Enter the following information at the prompts:

    Prompt Description
    Enter a CRM server name and port [crm.dynamics.com] Type the name of your Dynamics 365 Server. The default is Dynamics 365 for Customer Engagement (crm.dynamics.com) in North America.

    Example: myservername

    Example: myprefix.myservername:5500

    Example: crm5.dynamics.com

    Do not include the name of your organization or Internet protocol (http or https). You will be prompted for that later.
    Is this server configured for Secure Sockets Layer (https) (y/n) [n] Type y if the URL you use to access Dynamics 365 (online), version 8.2 begins with https://, otherwise type n. Dynamics 365 for Customer Engagement users do not see this prompt.
    Is this organization provisioned in Microsoft Online Services (y/n) [n] Type y if this is a Microsoft Online Services provisioned organization. Otherwise, type n.

    Only Dynamics 365 for Customer Engagement users see this prompt.
    Enter domain\username For Dynamics 365 for Customer Engagement, type your network domain and user name separated by a backslash (\). For Dynamics 365 for Customer Engagement (on-premises), enter your Microsoft account.

    On-premises/IFD Example: mydomain\tadams

    Online Example: terryadams@somedomain.onmicrosoft.com

    If you just press <Enter> for the user name, the program will look for and use saved credentials. If there are no saved credentials, the program will fail.
    Enter password Type your password. The characters will show as “*” in the window. Your password is securely saved in the Microsoft Credential Manager for later reuse.
    Specify an organization number (1-n) [1] From the list of organizations shown that you belong to, type the corresponding number. The default is 1, indicating the first organization in the list.
    Do you want these entity records deleted? (y/n) [y] Type y for yes and n for no. After the program runs, demonstrating create, retrieve, and update of an account record, you can delete the record that was created, or you can leave it so that you can view it in the application.
    Press Enter to exit Press Enter to exit the program.

Next Steps

After running the QuickStart program or most other SDK console-based samples, the server, organization, and user name information you entered when prompted is saved in an XML configuration file for re-use the next time you run a sample. This removes the need to enter that information again as you run additional samples. After the first time, the console prompts are as follows.

Prompt Description
Specify the saved server configuration number (1-x) [x]: Enter zero (0) to create a new server configuration and follow the prompts as shown in the table above. Otherwise, enter the number of a saved configuration as shown in the displayed list.
Enter Password: Type your password. The characters will show as “*” in the window. If your password has been saved from a previous sample run, you will not see this prompt.
Do you want these entity records deleted? (y/n) [y] Type y for yes and n for no. After the program runs, demonstrating create, retrieve and update of an account record, you can delete the record that was created, or you can leave it so that you can view it in the Web application or Dynamics 365 for Outlook.
Press Enter to exit Press Enter to exit the program.

If you would like to add or modify the functionality of this QuickStart program, you can modify the code in the CRUDOperations.cs file.

For more information about the helper code files that the QuickStart and many other SDK samples use, refer to the helper source code that handles saving and re-using the server configuration information located under the "SDK Helper Code" folder of the QuickStart sample.

A second sample project, named QuickStart with Simplified Connection, is included in the Visual Studio solution. This second sample shows a simplified method to connect to the Dynamics 365 Customer Engagement (on-premises) Organization service but is otherwise similar to the first QuickStart sample. This sample does not use any helper code to establish a web service connection.

See also

Tutorials for Learning Dynamics 365 Customer Engagement (on-premises)
Sample: Quick Start for Dynamics 365 Customer Engagement
Sample: Simplified Connection Quick Start using Dynamics 365 Customer Engagement (on-premises)
Write Code for Dynamics 365 Customer Engagement (on-premises)
Sample Code Directory for Dynamics 365 Customer Engagement (on-premises)