Monday, June 27, 2011

How to Check which Edition of SSRS You are Talking To Via The Report Server Web Service

In some situations you might want to make sure that you are talking to the right edition of SSRS. And by talking, I do mean programmatically rather than actually talking to your reporting server. That would be weird.

The first point worth noting is that the URL for accessing the report server web service varies depending on which version you are running:

SSRS 2008 R2 and Denali:

http://<Server Name>/reportserver/reportservice2010.asmx

 

SSRS 2008 and 2005:

http://<Server Name>/reportserver/reportservice2005.asmx

 

For an application I am currently working on, I needed to make sure that SSRS 2008 R2 Enterprise Edition was installed before I tried using features such as data-driven subscriptions.

Here is some sample code to get the SSRS Edition and return it as a string:

 

public static string GetEdition(string url)

     ReportingService2010 RS = new ReportingService2010();

     RS.Url = url;

     RS.Credentials =

         System.Net.CredentialCache.DefaultCredentials;

     RS.Timeout = Timeout.Infinite;

 

     RS.ServerInfoHeaderValue = new ServerInfoHeader();

     RS.ListChildren("/", true);

 

     return RS.ServerInfoHeaderValue.ReportServerEdition;

}

 

No comments: