Export SRS 2008 Report from Windows Applications

The following code was written and tested against SQL Server 2008 R2 Reporting Services. The helper classes help reduce and simplify the amount of code you’ll have to write (and remember) when exporting reports from SRS. I included the ReportExecutionService proxy class that I generated using the WSDL.exe tool. However, you can add a web reference to it using the GUI tools in VS.NET. For those of you who are interested in the command I used:

Open the Visual Studio 2010 Command Prompt (it should be located in Start>All Programs>Visual Studio 2010>Visual Studio Tools>Visual Studio Command Prompt) and enter the following:


·         C:\wsdl http://localhost/reportserver/reportexecution2005.asmx



Here’s what the code will look like to export a report:

NunoSolutions.Report rpt = new NunoSolutions.Report();

rpt.ReportServerUrl = http://localhost/ReportServer; // Change localhost in this path to your server’s name

rpt.ReportTitle = “My Northwind Customers”; // This value is used as the file name

rpt.ReportFormat = NunoSolutions.REPORT_FORMAT.PDF;

rpt.ReportPath = “/Northwind Reports/Northwind Customers”; // The “/Northwind Reports” part is the folder name in Report Server/Manager

// The credential set below must have access to the report server

NunoSolutions.ReportHelper.UserName = “<YourUserName>”;

NunoSolutions.ReportHelper.Password = “<YourPassword>”;

NunoSolutions.ReportHelper.Domain = string.Empty; // In corporate environments you’ll need to set this

// You can change this method declaration to support a file path input parameter.

// For demo purposes, I have a Folder Browser Dialog popup to prompt you where

// you’d like to save the report file.



Download the sample source code here:

NunoSolutionsWindows.7z (61.39 kb)

Leave a Reply