Sample code directory for Dynamics 365 Customer Engagement

Applies to Dynamics 365 (online), version 9.x

The following sample code is included for Dynamics 365 (online).

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 (CRUD) an E-Mail Attachment
Sample: Promote an E-mail Message to Dynamics 365
Sample: Retrieve E-mail Attachments for an E-mail Template
Sample: Send an E-mail
Sample: Send an E-mail 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: Assign Security Role to 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 Dynamics 365 Web Services
Sample: Impersonate Using the ActOnBehalfOf Privilege
Sample: Quick Start for Dynamics 365
Sample: Simplified Connection Quick Start using Dynamics 365
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 (CRUD) 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)

Dynamics 365 for Outlook

Sample: Create and Retrieve Outlook Filters
Sample: Use Dynamics 365 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 (CRUD) a Recurring Appointment
Sample: End a Recurring Appointment
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 Recurring Appointment
Sample: Schedule a Resource
Sample: Validate an Appointment

Customization & metadata

Sample: Create a Custom Activity
Sample: Create a Custom Activity Entity
Sample: Create Global Option Set
Sample: Create and Retrieve Entity Relationships
Sample: Create and Update an Emailable Entity
Sample: Create and Update Entity Metadata
Sample: Detect Solution Dependencies
Sample: Dump Attribute Metadata to a File
Sample: Dump Atttribute 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: Set and retrieve entity images
Sample: Web Resource Utility
Sample: Work with Attributes
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: Accessing 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 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: Initialize a Record From an Existing Record
Sample: Merge Two Records
Sample: Retrieve Valid Status Transitions
Sample: Rollup Records Related to a Specified Record
Sample: Serialize and Deserialize an Entity
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 and Set State of an Entity
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: Android Activity Tracker for Dynamics 365
Sample: iOS Activity Tracker for Dynamics 365

Organization web service

Sample: Authenticate Users with Dynamics 365 Web Services
Sample: Execute Multiple Requests
Sample: Execute multiple requests in transaction
Helper Code: ServerConnection Class
Helper Code: SystemUserProvider class
Sample: Impersonation using the ActOnBehalfOf privilege
Sample: Quick Start for Dynamics 365 Customer Engagement
Sample: Simplified Connection Quick Start using Dynamics 365 Customer Engagement
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 (CRUD) a Dialog
Sample: Execute 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 Query Expression
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 Query By Attribute Using Strong Types
Sample: Retrieve Multiple with Query Expression Using Strong Types
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: Use QueryExpression with a paging cookie
Sample: Validate and Execute a Saved Query

Queues

Sample: Add a Record to a Queue (Early Bound)
Sample: Add a principal 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 Using (Early Bound)
Sample: Share A Queue (Early Bound)
Sample: Specify a Queue Item to Work On (Early Bound)

Reports

Sample: Download Report Definition
Sample: Get Report History Limit
Sample: Make a Report Available or Unavailable to Organization
Sample: Publish a Report

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 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: Roll Up Goal Data for a Custom Period Against the Target Revenue
Sample: Roll Up 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 (CRUD) 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 Dynamics 365