Κοινή χρήση μέσω


Run a simple program using Microsoft Dynamics 365 web services

 

Applies To: Dynamics 365 (online), Dynamics 365 (on-premises), Dynamics CRM 2016, Dynamics CRM Online

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

  • Download the Microsoft Dynamics CRM SDK.

  • You must be able to sign in to Microsoft Dynamics 365 or Microsoft Dynamics 365 (online).

  • Microsoft Visual Studio 2012, or 2013

  • Microsoft .NET Framework 4.5.2

Compile and run the Quick Start sample

  1. Locate and open the SDK\SampleCode\CS\QuickStart folder.

  2. Open the QuickStart.csproj file in Visual Studio.

  3. Press F5 to compile and run the program.

  4. Enter the following information at the prompts:

    Prompt

    Description

    Enter a CRM server name and port [crm.dynamics.com]

    Type the name of your Microsoft Dynamics 365 server. The default is Microsoft Dynamics 365 (online) (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 begins with https://, otherwise type n. Microsoft Dynamics 365 (online) 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 Microsoft Dynamics 365 (online) users see this prompt.

    Enter domain\username

    For Microsoft Dynamics 365, type your network domain and user name separated by a backslash (\). For Microsoft Dynamics 365 (online), 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 Web application or Microsoft Dynamics 365 for Outlook.

    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 Microsoft 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, or to learn about how to set up a new project with the required assembly references, refer to Use the sample and helper code. For more information about the source code that handles saving and re-using the server configuration information, see Helper code: ServerConnection class.

A second sample project, named QuickStart with Simplified Connection, is included in the Microsoft Visual Studio solution. This second sample shows a simplified method to connect to the Microsoft Dynamics 365 Organization web 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 and resources for learning about development for Microsoft Dynamics 365
Sample: Quick start for Microsoft Dynamics 365
Sample: Simplified connection quick start using Microsoft Dynamics 365
Extend Microsoft Dynamics 365 on the server
Sample code directory for Microsoft Dynamics 365
Build a .NET Business Application in 60 Minutes with xRM and SharePoint

Microsoft Dynamics 365

© 2016 Microsoft. All rights reserved. Copyright