Sample code directory

 

Applies To: Dynamics CRM 2015

The following sample code is included for Microsoft Dynamics CRM 2015 and Microsoft Dynamics CRM Online.

In This Topic

Activities

Administration & security

Auditing

Authentication

Azure

Bulk Delete

Business process flows

Charts and dashboards

Connections

CRM for Outlook

Currency

Customer service and scheduling

Customization & metadata

Data import

Deployment web service

Discovery web service

Duplicate detection

Entity records

Knowledgebase

Marketing

Mobile

OData

Organization web service

Plug-ins

Processes, workflows and dialogs

Product catalog

Solutions

Time zone

Web resources

Activities

Sample: Collaborate with activity feeds

Sample: Convert a fax to a task

Sample: Create an email using a template

Sample: Create, retrieve, update, and delete an email attachment

Sample: Promote an email message to Microsoft Dynamics CRM

Sample: Retrieve email attachments for an email template

Sample: Send an email

Sample: Send an email using a template

Sample: Send bulk email and monitor results

Sample: Upload, retrieve, and download an attachment

Sample: Work with activity party records

Administration & security

Sample: Associate a security role to a team

Sample: Associate a Security Role to a User

Sample: Create an on-premises user

Sample: Determine whether a user has a role

Sample: Disable a user

Sample: Enable field security for an entity

Sample: Remove a role for a user

Sample: Retrieve field permissions

Sample: Retrieve field sharing records

Sample: Retrieve license information

Sample: Retrieve the roles for an organization

Sample: Retrieve time zone information

Auditing

Sample: Audit entity data changes

Sample: Audit user access

Authentication

Sample: Authenticate users with Microsoft Dynamics CRM web services

Sample: Impersonate using the ActOnBehalfOf privilege

Sample: Quick start for Microsoft Dynamics CRM

Sample: Simplified connection quick start using Microsoft Dynamics CRM

Sample: Quick start for XRM Tooling API

Azure

Sample: Azure aware custom plug-in

Sample: Azure aware custom workflow activity

Sample: One-way listener

Sample: Two-way listener

Bulk Delete

Sample: Bulk delete exported records

Sample: Bulk delete records that match common criteria

Business process flows

Sample: Xrm.Page.data.process.getEnabledProcesses

Sample: Xrm.Page.data.process.getActivePath

Charts and dashboards

Sample: Assign a chart to another user

Sample: Assign a user-owned dashboard to another user

Sample: Create, retrieve, update, and delete a dashboard

Sample: Create, retrieve, update, and delete a chart

Sample: Retrieve all charts attached to an entity

Connections

Sample: Create a connection (early bound)

Sample: Create a connection role (early bound)

Sample: Create a reciprocal connection role (early bound)

Sample: Query connections by a record (early bound)

Sample: Query connections by reciprocal roles (early bound)

Sample: Query connection roles by entity type code (early bound)

Sample: Update a connection role (early bound)

CRM for Outlook

Sample: Create and retrieve Outlook filters

Sample: Use CRM for Outlook methods

Currency

Sample: Retrieve currency exchange rate

Customer service and scheduling

Sample: Book an appointment

Sample: Close an incident

Sample: Convert an appointment to a recurring appointment

Sample: Create, retrieve, update, and delete a recurring appointment

Sample: End a recurring appointment series

Sample: Link custom attributes between series and instances

Sample: Manage contracts

Sample: Query the working hours of a user

Sample: Query the working hours of multiple users

Sample: Reschedule and cancel a recurring appointment

Sample: Search for openings to schedule a resource

Sample: Validate an appointment

Customization & metadata

Sample: Create a custom activity

Sample: Create a custom activity entity

Sample: Create a global option set

Sample: Create and retrieve entity relationships

Sample: Create and update an emailable entity

Sample: Create and update entity metadata

Sample: Create dependent OptionSets (picklists)

Sample: Detect solution dependencies

Sample: Dump attribute metadata to a file

Sample: Dump attribute picklist metadata to a file

Sample: Dump entity metadata to a file

Sample: Dump entity privilege information to a file

Sample: Dump entity relationship information to a file

Sample: Dump global option set information to a file

Sample: Export ribbon definitions

Sample: Import files as web resources

Sample: Pass multiple values to a web resource through the data parameter

Sample: Query metadata and detect changes

Sample: Retrieve entity metadata using JavaScript

Sample: Set and retrieve entity images

Sample: Web resource utility

Sample: Work with attribute metadata

Sample: Work with global option sets

Sample: Work with solutions

Sample: Work with views

Data import

Sample: Export and import a data map

Sample: Import data using complex data map

Deployment web service

Sample: Use deployment service messages

Discovery web service

Sample: Access the Discovery service

Duplicate detection

Sample: Detect multiple duplicate records

Sample: Enable duplicate detection and retrieve duplicates

Sample: Use duplicate detection when creating and updating records

Entity records

Sample: Assign a record to a new owner

Sample: Assign a record to a team

Sample: Associate and disassociate records using the OData endpoint with JavaScript

Sample: Associate records (early bound)

Sample: Create, retrieve, update, and delete records (early bound)

Sample: Create and update records with related records (early bound)

Sample: Create, retrieve, update, and delete (late bound)

Sample: Create, retrieve, update, and delete using the OData endpoint with JavaScript and jQuery

Sample: Create, retrieve, update, and delete using the OData endpoint with JavaScript and jQuery

Sample: Initialize a record from an existing record

Sample: Merge two records

Sample: Retrieve multiple records using the OData endpoint with JavaScript

Sample: Retrieve valid status transitions

Sample: Rollup records related to a specific record

Sample: Serialize and deserialize an entity Instance

Sample: Set and retrieve entity images

Sample: Share a record using an access team

Sample: Share records using GrantAccess, ModifyAccess and RevokeAccess messages

Sample: Validate record state and set the state of the record

Sample: Upload, retrieve, and download an attachment

Knowledgebase

Sample: Search and retrieve articles

Marketing

Sample: Distribute a quick campaign

Sample: Distribute campaign activities to dynamic and static lists

Sample: Distribute campaign activities to qualified marketing list

Mobile

Sample: Windows 8 desktop modern OData app

Sample: Windows 8 desktop modern SOAP app

OData

Sample: Associate and disassociate records using the OData endpoint with JavaScript

Sample: Create, retrieve, update, and delete using the OData endpoint with JavaScript

Sample: Create, retrieve, update, and delete using the OData endpoint with JavaScript and jQuery

Sample: OData endpoint jQuery contact editor

Sample: Retrieve multiple records using the OData endpoint with JavaScript

Sample: Windows 8 desktop modern OData app

Organization web service

Sample: Authenticate users with Microsoft Dynamics CRM web services

Sample: Execute multiple requests

Helper code: DeviceIdManager class

Helper code: ServerConnection class

Helper code: SystemUserProvider class

Sample: Impersonate using the ActOnBehalfOf privilege

Sample: Quick start for Microsoft Dynamics CRM

Sample: Simplified connection quick start using Microsoft Dynamics CRM

Sample: Use the organization service context

Plug-ins

Sample: Calculate Price plug-in

Sample: Create a basic plug-in

Sample: Web access from a sandboxed plug-in

Product catalog

Sample: Add products to a bundle

Sample: Calculate Price plug-in

Sample: Clone product records

Sample: Create and publish products

Processes, workflows and dialogs

Sample: Calculate a credit score with a custom workflow activity

Sample: Create a custom workflow activity

Sample: Create a process using a template

Sample: Create a real-time workflow in code

Sample: Create a workflow in code

Sample: Create, retrieve, update, and delete a dialog

Sample: Run a workflow

Sample: Set the state of a workflow

Sample: Update next birthday using a custom workflow activity

Sample: Complex LINQ queries

Sample: Convert queries between Fetch and QueryExpression

Sample: Create a LINQ query

Sample: Create a LINQ query with late binding

Sample: More LINQ query examples

Sample: Retrieve multiple with condition operators using LINQ

Sample: Retrieve multiple with the QueryByAttribute class

Sample: Retrieve multiple with the QueryExpression class

Sample: Retrieve records from an intersect table

Sample: Retrieve with one-to-many relationship

Sample: Use aggregation in FetchXML

Sample: Use FetchXML with a paging cookie

Sample: Validate and execute a saved query

Queues

Sample: Add a record to a queue (early bound)

Sample: Add a security principal (user or team) to a queue (early bound)

Sample: Clean up history for a queue (early bound)

Sample: Create a queue (early bound)

Sample: Delete a queue (early bound)

Sample: Release a queue item to the queue (early bound)

Sample: Add a security principal (user or team) to a queue (early bound)

Sample: Specify a queue item to work on (early bound)

Reports

Sample: Download report definition

Sample: Get the report history limit

Sample: Make a report available or unavailable to organization

Sample: Publish a report

REST endpoint

Sample: Create, retrieve, update, and delete using the OData endpoint with JavaScript and jQuery

Sample: OData endpoint jQuery contact editor

Sample: REST listener

Sample: Retrieve multiple records using the OData endpoint with JavaScript

Sales: Leads, opportunities, quotes, orders, invoices, connections

Sample: Convert an opportunity to a quote (early bound)

Sample: Create a connection (early bound)

Sample: Create a connection role (early bound)

Sample: Create a reciprocal connection role (early bound)

Sample: Create an opportunity (early bound)

Sample: Fulfill a sales order

Sample: Override goal total count and close the goal

Sample: Process quotes, sales orders and invoices

Sample: Qualify a lead

Sample: Query connection roles by entity type code (early bound)

Sample: Query connections by reciprocal roles (early bound)

Sample: Retrieve an opportunity (early bound)

Sample: Rollup goal data for a custom period against the target revenue

Sample: Rollup goal data for a fiscal period against the stretch target count

Sample: Set negative prices in opportunities, quotes, and sales orders

Sample: Update a connection role (early bound)

Sample: Use rollup queries to track goals

Sample data

Sample: Install or remove sample data

SharePoint

Sample: Create, retrieve, update, and delete a SharePoint location record

Sample: Enable document management for entities

Sample: Retrieve absolute URL and site collection URL of a location record

Solutions

Sample: Detect solution dependencies

Sample: Work with solutions

Time zone

Sample: Retrieve time zone information

Web resources

Sample: Import files as web resources

Sample: Pass multiple values to a web resource through the data parameter

Sample: Web resource utility

See Also

Tutorials for learning about development for Microsoft Dynamics CRM

© 2016 Microsoft. All rights reserved. Copyright