Saturday 24 September 2011

Create new SSRS Report using ReportingService.CreateCatalogItem() method

This post explains about programmatically creating a new SSRS report using Reporting Services Web service.
PreRequisite : You must have SSRS(SQL Server Reporting Services) installed so that you can use Reporting web services provided by SSRS.

Step 1: Add Reference to Web Service()
The first thing you need to do is add a Web reference to the Reporting Services Web service in your development project that points to your report server. 
To do so right-click on your project in Visual Studio and choose Add Service reference... .Then Click on Advanced  and then "Add Web Reference.." as shown in below image..



Provide report server URL (in my case http://localhost/reportserver/ReportService2010.asmx). If you have a remote report server, simply change the URL of the Web reference. The end point for any Reporting Services Web service is http://servername/reportserver/ReportService2010.asmx.
Provide service reference name(i provided "ExecutionService" as reference name) and click on Add.

Step 2: Using  ReportingService.CreateCatalogItem method To create new Report
ReportingService.ReportingService2010 rs;rs = new ReportingService.ReportingService2010();
rs.Credentials Net.CredentialCache.DefaultNetworkCredentials;rs.Url "http://localhost/ReportServer/ReportService2010.asmx";
string 
_reportPath;_reportPath "/";
Byte[] reportDefinition = null;
ReportingService.Warning[] warnings = null;
ReportingService.CatalogItem newCreatedReport rs.CreateCatalogItem("Report""NewCreatedReport""/"false, reportDefinition, null, warnings);

After executing this code a new report will get created with report name/title as “NewCreatedReport” on root of reportServer i.e http://localhost/Reports


3 comments:

  1. Aw, this was a very nice post. Taking a few minutes
    and actual effort to generate a great article… but
    what can I say… I hesitate a lot and don't manage to get anything done.
    Here is my site - buy youtube views

    ReplyDelete
  2. It's remarkable to pay a quick visit this web site and reading the views of all colleagues regarding
    this piece of writing, while I am also zealous of getting experience.


    Also visit my web-site travailler au maroc (www.jobedge.net)

    ReplyDelete
  3. Very good information. Lucky me I recently found your blog
    by chance (stumbleupon). I've book marked it for later!


    Look into my web page ac leads - youtube.com,

    ReplyDelete