Our stand-alone server reporting solution combit Report Server (included with List & Label Enterprise Edition) has already provided an easy way for the integration with your own applications via its REST API for some years. The new combit.ReportServer.ClientApi assembly, which comes with version 23, enables you to use many (new) functions of the Report Server API with not more than a few simple lines of C#/VB.NET code. All HTTP communication is managed internally so using the REST API just became as easy as using any regular .NET library. The functions comprise the export of reports, uploading new report projects, creating new data sources, managing the server and more.
Introducing all functions of the new assembly would go way beyond the scope of this introductory blog post, so let us focus on one tiny code example to show you how easy it has become to get a report from the server. Note that nearly all features are demonstrated in the extensive sample project that comes with the new assembly. Imagine an app like the one you might have developed already with List & Label: We want to present a list of all available reports to the user and save the selected report as a PDF file. With combit Report Server, the project files and data sources are managed on the central server, so the first step is to load a list of the available projects:
Before we can do that, we of course have to authenticate & connect to the Report Server:
var options = new ClientOptions() { Authentication = new ApiTokenAuthentication("ApiClient123", "XXXXXXXX") }; var serverUrl = "http://localhost/combitReportServer"; var reportServer = await ReportServer.ConnectAsync(serverUrl, options);
After establishing the connection to the server, we can ask the server for a list of all report templates available to fill the ListBox:
var reportTemplates = await reportServer.ReportTemplates.GetAllAsync(); foreach (ReportTemplate report in reportTemplates) { listBox.Items.Add(report); }
Once the user hits the button, we may prepare the export (e.g. define some report parameters) and let the server export the PDF file.
var selectedReport = (ReportTemplate)listBox.SelectedItem; // Prepare the export on the client var preparedExport = reportServer.Exporter.PrepareExport(selectedReport.Id); preparedExport.ReportParameters.Add("Year", 2017); // Send the export job to the server var exportResult = await preparedExport.ExportAsync();
The only remaining task is to download the created PDF file to the client.
await exportResult.DownloadFilesAsync(@"C:\Reports");
That was easy:
Want some icing on the cake? The combit.ReportServer.ClientApi assembly is
- platform-independent,
- compatible with both .NET Classic and .NET Core (built against .NET Standard 1.3),
- fully supports the use of async/await and
- comes with an extensive C# sample project and a comprehensive documentation.
If you would like to migrate existing List & Label projects and their data sources of your own application to the Report Server automatically for the report to be accessible from all major operating systems, web browsers and devices, we have a second new assembly for you: combit.ListLabel.ReportServerIntegration.
This library provides helper methods for uploading List & Label projects and their dependencies (e.g. images, drilldown projects) and creating data sources on the server from the data providers you know from List & Label. The mentioned sample project demonstrates these features, too.