Skip to content

Instantly share code, notes, and snippets.

@ielcoro
Forked from anonymous/historyReports.cs
Last active August 29, 2015 14:15
Show Gist options
  • Save ielcoro/2dbb9a97db8ee2152984 to your computer and use it in GitHub Desktop.
Save ielcoro/2dbb9a97db8ee2152984 to your computer and use it in GitHub Desktop.
Reporting Services Examples

###Todos los ejemplos parten de añadir las siguientes referencias a los servicios de Reporting Services:

  • http:///ReportServer/ReportService2010.asmx
  • http:///ReportServer/ReportExecution2005.asmx
using (var rs = new ReportingService2010())
{
rs.Url = reportingURL;
rs.Credentials = new NetworkCredential(reportingUsuario, reportingPassword, reportingDominio);
return rs.ListItemHistory("/ruta/informe");
}
using (var rs = new ReportingService2010())
{
rs.Url = reportingURL;
rs.Credentials = new NetworkCredential("usuario", "password", "reportingDominio");
CatalogItem[] items = rs.ListChildren("ruta", true);
return items.Where(x => x.TypeName == ItemTypeEnum.Report.ToString()).ToList();
}
using (var rs = new ReportExecutionService.ReportExecutionService())
{
string extension = null;
string encoding = null;
string mimeType = null;
string[] streamIDs = null;
Warning[] warnings = null;
rs.Url = "http://<reportserverurl>/ReportServer/ReportExecution2005.asmx";
rs.Credentials = new NetworkCredential("usuario", "contraseña", "dominio");
string historyId = null;
ExecutionHeader execHeader = new ExecutionHeader();
rs.Timeout = 300000;
rs.ExecutionHeaderValue = execHeader;
ExecutionInfo2 execInfo2 = rs.LoadReport2(reportPath, historyId);
if ((parameters != null))
{
rs.SetExecutionParameters(parameters, "es_es");
}
string deviceInfo = @"<DeviceInfo><Toolbar>False</Toolbar></DeviceInfo>";
return rs.Render2("PDF", deviceInfo, PageCountMode.Actual, out extension, out encoding, out mimeType, out warnings, out streamIDs);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment