This guide walks you through the process of integrating your ASP.NET Core Blazor application with Zoho CRM using dotConnect for Zoho CRM — a powerful ADO.NET provider from Devart. Here, you'll learn how to set up OAuth authentication, connect to the CRM API, and perform basic data operations (read, insert, delete) directly from your Blazor frontend or backend logic.
Why dotConnect for Zoho CRM?
Quick and easy integration
dotConnect enables straightforward connectivity between .NET applications and Zoho CRM, allowing developers to access CRM modules and records without working directly with Zoho's REST APIs.
User-friendly classes
Using familiar ADO.NET components, dotConnect for Zoho CRM allows developers to work with data through standard .NET data access patterns such as connections, commands, and data readers.
Advanced ORM support
dotConnect works with EF Core, Dapper, NHibernate, and LinqConnect, enabling flexible object-relational mapping and efficient interaction with Zoho CRM data in .NET applications.
Interactive OAuth token generation
Access to Zoho CRM is authorized through a browser-based login flow. After successful authentication, dotConnect automatically retrieves and manages access and refresh tokens for secure connections.
Full compliance with ADO.NET
Devart implements the standard ADO.NET provider model in dotConnect solutions, ensuring consistent behavior and compatibility with existing .NET frameworks and development tools.
Priority support & frequent updates
Devart provides professional technical assistance, comprehensive documentation, and ongoing product enhancements, helping developers maintain stable and reliable integrations with Zoho CRM.
Download and activate dotConnect for Zoho CRM
You can start using dotConnect for Zoho CRM immediately with a 30-day free trial. Choose one of the following installation options:
using System;
using System.Data;
using Devart.Data.Zoho;
namespaceZohoBlazor
{
publicclassZohoCrmService
{
privatereadonly AppConfig _config;
publicZohoCrmService(AppConfig config)
{
_config = config;
}
publicboolCheckConnection()
{
try
{
using (var connection =
new ZohoConnection(_config.GetConnectionString()))
{
connection.Open();
returntrue;
}
}
catch (Exception)
{
returnfalse;
}
}
public DataTable
GetAccounts()
{
using (var connection =
new ZohoConnection(_config.GetConnectionString()))
{
connection.Open();
var command =
new ZohoCommand(
"SELECT \"Account Name\", Phone, Website, \"Account Type\" FROM Accounts",
connection
);
var adapter = new ZohoDataAdapter(command);
var dataTable = new DataTable();
adapter.Fill(dataTable);
return dataTable;
}
}
}
}
The CheckConnection method checks whether a connection to Zoho CRM can be established using the provided configuration.
The GetAccounts method retrieves data from the Account table in Zoho CRM.
The method initiates the connection to Zoho CRM and executes an SQL command to select specific fields from the table.
Also, it uses ZohoDataAdapter to fill DataTable with the results of the query and returns DataTable.
Register the service in Startup.cs
Register ZohoCrmService.cs and AppConfig.cs in the Program.cs file.
Run the application and navigate to the Accounts page to see the connection status and the data from the Accounts table.
This example provides a basic setup for connecting to Zoho CRM and displaying data from the table in the Blazor application.
Make sure to replace the placeholder values in AppConfig.cs with your Zoho CRM credentials.
Insert new data
To further enhance your Blazor application, we'll create a form that adds a new account to Zoho CRM.
We'll also create a custom endpoint to handle the form submission. Here's how to do it.
Step 1. Create a form in Accounts.razor
First, let's add a new form to the Accounts.razor component. This form will allow users to input details for a new account and submit them.
Step 2. Add the JavaScript interop functionality to display alerts
To use JavaScript's alert function from Blazor, you need to inject the IJSRuntime service into your component. Paste this code into the @code section of Accounts.razor.
// Custom endpoint for adding an account
app.MapPost("/accounts/insert", async (HttpContext context, ZohoCrmService zohoCrmService) =>
{
if (
context.Request.Query.TryGetValue("AccountName", outvar accountName) &&
context.Request.Query.TryGetValue("Phone", outvar phone) &&
context.Request.Query.TryGetValue("Website", outvar website) &&
context.Request.Query.TryGetValue("AccountType", outvar accountType))
{
var account = new Account
{
Name = accountName,
Phone = phone,
Website = website,
Type = accountType
};
bool success = zohoCrmService.InsertAccount(account);
string message = success
? "Account inserted successfully."
: "Failed to insert account. Account may already exist.";
await context.Response.WriteAsync(message);
}
else
{
await context.Response.WriteAsync("Invalid request parameters.");
}
});
Step 4. Update MainLayout.razor
In the MainLayout.razor file, place the JavaScript function inside the article section.
This ensures that the script is loaded and available for all components that use this layout.
When you add the script to MainLayout.razor, it loads once and works across all components that use the layout.
This ensures that the insertAccount function is defined and accessible when the form is submitted.
The form in Accounts.razor calls the window.insertAccount function when submitted. This function is now globally available because it is defined in the layout file.
Let's try to add a new test account.
Click OK to reload the page and see the result.
Delete data
To add the Delete button next to each row in the table and implement the functionality for removing a row from Zoho CRM, you can follow these steps.
Step 1. Update ZohoCrmService.cs to include the Delete method
First, add the method to ZohoCrmService.cs that deletes an account based on the account name.
Step 3. Update Accounts.razor to include Delete buttons
Modify the Accounts.razor component to implement a delete button next to each row in the table. This button will call a JavaScript function to handle the deletion.
Step 4. Add a JavaScript function to delete an account
Add a JavaScript function to handle account deletion. This function will be called when the delete button is clicked. You can place it in the <script> section of MainLayout.razor.
Click OK to check that the account has been deleted.
This setup allows you to remove accounts from Zoho CRM and see the updated list of accounts. The alert indicates the success or failure of the operation.
Conclusion
With dotConnect for Zoho CRM, you can quickly connect a .NET Blazor application to Zoho CRM and perform data operations using familiar ADO.NET interfaces. This approach eliminates the need for custom HTTP request handling or manual token management.
FAQ
How do you install and activate dotConnect for Zoho CRM in a .NET project?
Install dotConnect for Zoho CRM using the EXE installer or by adding the
Devart.Data.Zoho NuGet package to your project.
Then obtain your Activation Key from your
Devart Customer Portal
and include it in the connection string via the License Key parameter.
How do you authenticate to Zoho CRM using Interactive OAuth in dotConnect?
To authenticate with Zoho CRM, use the connection string parameter:
Authentication Type=OAuthInteractive
When the ZohoConnection opens,
a browser window appears for you to sign in to your Zoho account and grant access.
After authorization, dotConnect automatically retrieves and manages the access and refresh tokens.
How do you create a connection to Zoho CRM using dotConnect in C#?
Define a connection string that includes the Url of your Zoho CRM account,
the authentication parameters, and the License Key. Then create a
ZohoConnection instance and call Open() inside a try-catch block
to establish the connection and handle potential errors.
Can you query Zoho CRM data using SQL with dotConnect?
Yes, dotConnect allows you to retrieve and manage Zoho CRM modules using SQL queries.
Developers can work with entities such as Leads, Contacts,
Accounts, and Deals using familiar SQL syntax.
Can you connect to Zoho CRM using Entity Framework Core and dotConnect?
Yes, you can use Entity Developer to visually generate an EF Core model
from Zoho CRM modules, or run Scaffold-DbContext with the
Devart.Data.Zoho.EFCore package and a dotConnect connection string
(including License Key) to create the DbContext and entity classes.
Is it possible to explore Zoho CRM data using Visual Studio Server Explorer with dotConnect?
Yes. Open Visual Studio Server Explorer, add a new Data Connection,
select dotConnect for Zoho CRM as the provider, configure OAuth authentication,
test the connection, and browse Zoho CRM modules directly from the IDE.
I'm a technical content writer who loves turning complex topics — think SQL, connectors, and backend chaos–into content that actually makes sense (and maybe even makes you smile). I write for devs, data folks, and curious minds who want less fluff and more clarity. When I'm not wrangling words, you'll find me dancing salsa, or hopping between cities.