public ActionResult Index() { IReportServerClient client = new GuestConnectionProvider(ServerAddress).ConnectAsync().Result; IEnumerable <ReportModel> model = client.GetReportsAsync(null).Result.Select(x => new ReportModel { Id = x.Id, Name = x.Name }); return(View(model)); }
static void ExportToPdf(string serverAddress, string fileName, int reportId, params ReportParameter[] parameters) { IReportServerClient client = new GuestConnectionProvider(serverAddress).ConnectAsync().Result; //new ServerUserConnectionProvider(serverAddress, "demo", "demo").ConnectAsync().Result; //new WindowsUserConnectionProvider(serverAddress).ConnectAsync().Result; Task <byte[]> exportTask = Task.Factory.ExportReportAsync(client, new ReportIdentity(reportId), new PdfExportOptions(), parameters, null); File.WriteAllBytes(fileName, exportTask.Result); }