Back to Dynamics CRM Programming Languages Index

C# Dynamics CRM REST API Examples

More Dynamics CRM Examples at example-code.com.

Get Accounts
This example queries the accounts entity set and uses the $select system query option to return the name property for each account.

Retrieve a Single Account
This example returns data for an account entity instance with the primary key value equal to aca19cdd-88df-e311-b8e5-6c3be5a8b200. (This is for the Blue Yonder Airlines sample data.)

Lookup Account ID using Account Name
Gets the accountid by name.

Get Contacts
Returns the name and contactid for each Contact in the Dynamics CRM database. Also gets the name and accountid for the contact's account (if present).

Retrieve a Single Contact
Returns the full contact record for a given contactid.

Lookup Contact ID using Full Name
Find a contactid given a fullname.

Get an Account's Contacts
Returns the full name, email address, and phone number for each of an account's contacts. This example gets the contacts for the Coho Winery account (accountid = b0a19cdd-88df-e311-b8e5-6c3be5a8b200).

Get Phone Calls Regarding an Account
Returns the subject, description, start date/time and activity ID for phone calls regarding an account. This example gets the phone calls regarding the Fourth Coffee account (accountid = b6a19cdd-88df-e311-b8e5-6c3be5a8b200).

Get All Tasks
Returns the subject, description, start date/time,activity ID, and Regarding Object ID for all tasks.

Find Tasks for an Incident
Returns tasks for a specific incident.

Get System Users
Gets information about each systemuser.

Get All Incidents
Gets all incidents, and gets the account name and accountid by expanding the customerid_account lookup property.

Create a Phone Call
Creates a phone call record regarding the Fourth Coffee account (b6a19cdd-88df-e311-b8e5-6c3be5a8b200), regarding the "Faulty product catalog" incident (c49e62a8-90df-e311-9565-a45d36fc5fe8), from the system user Allie Bellew (832698d1-b86a-47b5-a9a3-0cc710eb22e4), to the contact Gabriele Cannata (57a0e5b9-88df-e311-b8e5-6c3be5a8b200). A successful response is indicated by a 204 response status code with no response body.

Create an Account
Creates a new account.

Create an Contact
Creates a new contact for a specific account. In this example, the account is Fourth Coffee, where the accountid = b6a19cdd-88df-e311-b8e5-6c3be5a8b200. Success is indicated by a 204 response status code with an empty response body.

Get All Incidents (Cases) for an Account
Returns selected data for all cases (incidents) specific to the Fourth Coffee account (b6a19cdd-88df-e311-b8e5-6c3be5a8b200)

Get All Information for a Specific Incident
Returns the entire JSON record for a specific incident.

Get All Products for the Vendor Named "Fabrikam"
Returns products for vendorname = "Fabrikam".