Skip to content

Latest commit

 

History

History
68 lines (62 loc) · 2.4 KB

how-to-download-all-reports-stored-on-report-server.md

File metadata and controls

68 lines (62 loc) · 2.4 KB
title description type page_title slug position tags ticketid res_type
Downloading All Reports Stored on Report Server
Download all report defintions that are stored on the report server
how-to
How to Download All Reports Stored on Report Server
how-to-download-all-reports-stored-on-report-server
1514505
kb

Environment

Product Progress® Telerik® Report Server

Description

This article explains how to download all report definitions that are stored on the Report Server with the Report Server API.

Solution

In our GitHub repository, you can find a Console application that downloads all TRDP/TRDX reports that are stored on the Report Server. Below are the required steps for building the application:

  • Add the following references:
    • Telerik.Reporting;
    • Telerik.ReportServer.HttpClient;
    • Telerik.ReportServer.Services.Models.
  • Create a setting for the Report Server connection;
var settings = new Telerik.ReportServer.HttpClient.Settings()
            {
                BaseAddress = "http://localhost:83/"
            };
  • Get all categories in the Report Server and for each of them get the reports:
using (var rsClient = new ReportServerClient(settings))
            {
                rsClient.Login("username", "password");
                var categories = rsClient.GetCategories();
                foreach (var category in categories)
                {
                    var reportInfos = rsClient.GetReportInfosInCategory(category.Id);
                    foreach (var reportInfo in reportInfos)
                    {
                        var reportId = reportInfo.Id;
                        var reportDefinition = rsClient.GetLatestReportRevision(reportId);
                        SaveReportDefintion(reportDefinition, reportInfo.Name);
                    }
                }
            }
  • Finally, save the report definitions:
private static void SaveReportDefintion(Telerik.ReportServer.Services.Models.ReportRevisionContent reportDefinition, string name)
        {
            var extension =reportDefinition;
            string path = "filepath" + name;
            File.WriteAllBytes(path + reportDefinition.Extension, reportDefinition.Content);
        }