![]() |
VOOZH | about |
Blazor is a framework for developing modern, client-side web UIs using .NET technology. Instead of coding in JavaScript, developers can use the familiar C# language and .NET libraries to build app UIs.
The CData ADO.NET Provider for SharePoint can be used with standard ADO.NET interfaces, such as LINQ and Entity Framework, to interact with live SharePoint data. Since Blazor supports .NET Core, developers can use CData ADO.NET Providers in Blazor apps. In this article, we will guide you to build a simple Blazor app that talks to SharePoint using standard SQL queries.
Accessing and integrating live data from SharePoint has never been easier with CData. Customers rely on CData connectivity to:
Most customers rely on CData solutions to integrate SharePoint data into their database or data warehouse, while others integrate their SharePoint data with preferred data tools, like Power BI, Tableau, or Excel.
For more information on how customers are solving problems with CData's SharePoint solutions, refer to our blog: Drivers in Focus: Collaboration Tools.
CData ADO.NET Providers allow users to access SharePoint just like they would access SQL Server, using simple SQL queries.
Install the SharePoint ADO.NET Data Provider from the CData website or from NuGet. Search NuGet for "SharePoint ADO.NET Data Provider."
๐ Install ADO.NET SharePoint Provider from NuGet.Start by creating a Blazor project that references the CData ADO.NET Provider for SharePoint
Set the URL property to the base SharePoint site or to a sub-site. This allows you to query any lists and other SharePoint entities defined for the site or sub-site.
The User and Password properties, under the Authentication section, must be set to valid SharePoint user credentials when using SharePoint On-Premise.
If you are connecting to SharePoint Online, set the SharePointEdition to SHAREPOINTONLINE along with the User and Password connection string properties. For more details on connecting to SharePoint Online, see the "Getting Started" chapter of the help documentation
For example: User=myuseraccount;Password=mypassword;Auth Scheme=NTLM;URL=http://sharepointserver/mysite;SharePointEdition=SharePointOnPremise;
@page "/"
@using System.Data;
@using System.Data.CData.SharePoint;
<h1>Hello, world!</h1>
Welcome to your Data app.
<div class="row">
<div class="col-12">
@using (SharePointConnection connection = new SharePointConnection(
"User=myuseraccount;Password=mypassword;Auth Scheme=NTLM;URL=http://sharepointserver/mysite;SharePointEdition=SharePointOnPremise;"))
{
var sql = "SELECT Name, Revenue FROM MyCustomList";
var results = new DataTable();
SharePointDataAdapter dataAdapter = new SharePointDataAdapter(sql, connection);
dataAdapter.Fill(results);
<table class="table table-bordered">
<thead class="thead-light">
<tr>
@foreach (DataColumn item in results.Rows[0].Table.Columns)
{
<th scope="col">@item.ColumnName</th>
}
</tr>
</thead>
<tbody>
@foreach (DataRow row in results.Rows)
{
<tr>
@foreach (var column in row.ItemArray)
{
<td>@column.ToString()</td>
}
</tr>
}
</tbody>
</table>
}
</div>
</div>
At this point, you have a SharePoint-connected Blazor app, capable of working with live SharePoint data just like you would work with a SQL Server instance. Download a free, 30-day trial and start working with live SharePoint data in your Blazor apps today.
Download a free trial of the SharePoint Data Provider to get started:
Download NowLearn more:
๐ SharePoint IconProvides .NET developers with the power to easily connect their Web, Desktop, and Mobile applications to data in SharePoint Server Lists, Contacts, Calendar, Links, Tasks, and more!