Geeks With Blogs
Justin Gardner .NET, T-SQL and Reporting Services Developer
Since the move from 2005 Reporting Services to 2008 Reporting Services one of my reports has been having a problem.

The report in question is an Excel rendering of the report available on the Report Server. This Excel file gets saved to a LAN location.

The report also uses a fairly long cache but this is no different than our other reports. I am not sure what's causing just this one report to act in this way but each day when the Excel version of the report is opened it displays the prior days data and report date.

In order to get around this, I'm using the FlushCache method call to the Reporting Services 2005 web service.

TechNet documentation on the method:

A basic script usable from the command line with the RS.EXE utility:
Public Sub Main()
If ReportPath Is Nothing Then
Console.WriteLine("Parameter ReportPath not specified")
End If
End Sub
Assume you've saved the above script as clearcache.rss and your report server url is http://myhost/reportserver, the following would execute the clearcache.rss script against a report named ClearMe hosted on your report server:

rs -i clearcache.rss -s http://myhost/reportserver -v ReportPath="Reports/ClearMe"

I've set up my script to take a text file for input that contains all of the reports on my system and some delimiters that separate fields representing directories and such. So, I might add the following to the above command to accept my input file:

rs -i clearcache.rss -s http://myhost/reportserver -v reportsfile=allreports.txt

In my script there is a variable called reportsfile. The above simply assigns allreports.txt to that variable. This is just to show that you can pass parameters via the command line to populate variables in your script.

One thing that is important to remember when calling the FlushCache() method is that you need to have Publisher or Content Manager permissions on the Reporting Manager. If you have less permissions, you'll receive an error:

The permissions granted to user 'DOMAIN\USERID' are insufficient for performing this operation. Posted on Tuesday, March 10, 2009 9:56 AM SQL Server Reporting Services | Back to top

Comments on this post: Reporting Services - FlushCache()

No comments posted yet.
Your comment:
 (will show your gravatar)

Copyright © Justin | Powered by: