Work with data using code in Microsoft Dataverse

There are several different ways to access Dataverse data using code.

This article introduces the options you have to work with Dataverse data using code.

Retrieve, add, and modify data

Dataverse provides two ways to retrieve, add, and modify data: SDK for .NET & Web API. Choose the one that best matches the requirements, your skills, and preferences.

Flow diagram to choose programming style

SDK for .NET

If you are working with .NET, we recommend using our SDK for .NET.

The Dataverse SDK for .NET supports build targets for both .NET Framework and .NET 6+. However, plug-in and custom workflow activities must use .NET Framework.

If you are using our PowerShell module or using our custom log-in control with a Windows client application, use the the Xrm.Tooling

Web API

The Dataverse Web API is an OData v4 RESTful endpoint. Use the Web API for any programming language that supports HTTP requests and authentication using OAuth 2.0, including .NET.

Search Dataverse data

Dataverse search delivers fast and comprehensive search results across multiple tables, in a single list, sorted by relevance. It also provides capabilities to support suggestions and autocompletion experiences in apps.

Search has a native endpoint and there are Dataverse messages that you can use from the Web API or SDK for .NET.

Learn to search for Dataverse records

Query data with SQL

The Power Query Dataverse connector uses the Dataverse Tabular Data Stream (TDS) endpoint to retrieve data using Dataverse SQL, a subset of Transact-SQL.

Retrieving data using SQL Management Studio (SSMS) is a preview feature.

Learn to use SQL to query data

Limitations

There's a 1-GB size limitation on the size of a response that Dataverse returns. Few APIs or queries are capable of returning this much data. If you encounter this limit, you should consider what other options are available to get the data in multiple, smaller requests.

The deprecated SOAP endpoint returns serialized XML data that is much more verbose than the serialized JSON data returned by the Web API. If you're using the deprecated SOAP endpoint, you should use the Web API equivalent operation. More information: About the legacy SOAP endpoint