views:

890

answers:

3

This question asks how to restrict for a whole server. I just want to do so for a single report. I found a code snippet but it doesn't provide any clues on how to implement:

 foreach (RenderingExtension extension in this.reportViewer.LocalReport.ListRenderingExtensions()) {
if (extension.Name == "PDF") {            
((Extension)(extension.GetType().GetField("m_serverExtension", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance).GetValue(extension))).Visible = false;
}

I can't see how to make the report reference this code upon loading. Does anyone know how I am supposed to make the report execute this code?

EDIT: Incidentally report access is through the SSRS Report Manager web app. We are, in the main, delighted with this product so wouldn't consider reinventing the wheel in order to implement a hack to produce what is, essentially a "would be nice" feature.

It still boggles the mind slightly that the report's available rendering options are not controllable at the report level. Ho hum.

A: 

Incidentally I found this blog entry which clarifies the above code a little. Turns out we're talking about using a reportviewer component to limit the export options. Apparently this requires a dirty, dirty hack and besides it's not how we want to run our reporting function.

So unless anyone has a better idea than this within the next fortnight I'll mark this as the answer which basically sums up to:

You can only restrict functionality like this under certain conditions and by no means easily even when you do.

This seems like a clear failure in the wider fitness of SSRS for purpose as we have users who require Excel export functionality and users who need to be limited to PDF only. Oh well.

A: 

You haven't really described how you are calling the reports - have you created some kind of application? Are you actually using the report viewer control?

You can generate a report in a specific format using the report URL and including the rs:Format parameter, e.g.

http://SERVER/reportserver?%2fSomeFolder%2fSomeReport&rs:Command=Render&rs:Format=PDF

The above URL generates the report as a PDF. You can also use the URL to hide the report toolbar etc. so you could create these URLs as links in your application, maybe one using just rs:Command=Render as a "View Report" link and one link that includes rs:Format=PDF as an "Export to PDF" link.

More on Reporting Services URL access.

Nathan
Unfortunately access is through the bundled "Report Manager" server. And on this you either configure available options for every report or none at all. Thanks for trying.
A: 

Does it matter?

Once they've downloaded the data and taken it offsite, you've lost it anyway.

adolf garlic