Web API Data operations Samples (C#)

This topic provides information about the Web API samples implemented with C# using .NET 6.0. While each sample focuses on a different aspect of the Microsoft Dataverse Web API, they share similar characteristics and structure.


The following is required to build and run the Dataverse Web API C# samples :

  • A version of Microsoft Visual Studio 2022 or later. A free version, Visual Studio Community, is available for download here.

  • Access to Dataverse with an account that has the System Administrator security role.

WebApiService class library

These samples use the WebAPIService class library (C#) to provide re-usable common code that handles re-triable service protection limit errors. More information: Service protection API limits

Web API samples listing (C#)

The following table lists the samples implemented in C#. Each sample is described in a more general manner in a corresponding sample group topic that focuses on the HTTP request and response messages, as detailed in the topic Web API Samples.

Sample Sample Group Description
Web API Basic Operations Sample (C#) Web API Basic Operations Sample Demonstrates how to create, retrieve, update, delete, associate and disassociate Dataverse entity records.
Web API Query Data sample (C#) Web API Query Data Sample Demonstrates how to use OData v4 query syntax and functions as well as Dataverse query functions. Includes examples of working with pre-defined queries and using FetchXML to perform queries.
Web API Conditional Operations sample (C#) Web API Conditional Operations Sample Demonstrates how to perform conditional operations you specify with ETag criteria.
Web API Functions and Actions Sample (C#) Web API Functions and Actions Sample Demonstrates how to use bound and unbound functions and actions, including custom actions.
Web API Metadata Operations Sample (C#) Web API Metadata Operations Sample Demonstrates how to perform selected operations that modify the Dataverse schema, or metadata.

The following samples demonstrate methods to add parallelism and concurrency to applications. These capabilities are an important part of maximizing throughput when performing operations that will add or update data within Dataverse.

How to download and run the samples

The source code for each sample is available on GitHub at: PowerApps-Samples/dataverse/webapi/C#-NETx/. You can download the repository as a zip file which contains the solution files for the samples. For more information, see the How to run this sample section in each sample topic.

See also

Use the Dataverse Web API
Web API Samples
Web API Samples (Client-side JavaScript)
WebAPIService class library (C#)