Rendering reports via Url Access

Querying Reporting Services for a report couldn't be easier with Url Access (https://msdn2.microsoft.com/en-us/library/ms153586.aspx).  For example:

String report = "/Folder/Report";
String filename = "Report.pdf";
List<KeyValuePair<String, String>> parameters =
    new List<KeyValuePair<String, String>>();
parameters.Add(new KeyValuePair<String, String>("Param1", "Value1"));
parameters.Add(new KeyValuePair<String, String>("Param2:isnull", "true"));

System.Net.WebClient client = new System.Net.WebClient();
client.Credentials = System.Net.CredentialCache.DefaultCredentials;
String url = "https://localhost/reportserver?" +
    report + "&rs:Command=Render&rs:Format=PDF";
foreach (KeyValuePair<String, String> parameter in parameters)
    url += "&" + parameter.Key + "=" + parameter.Value;
client.DownloadFile(new Uri(url), filename);

Comments

  • Anonymous
    October 12, 2007
    PingBack from http://www.artofbam.com/wordpress/?p=8044

  • Anonymous
    October 15, 2007
    Why is this post not showing up in your RSS feed? Very odd.

  • Anonymous
    October 17, 2007
    This problem should now be resolved.  Thanks.