Jasinski Technical Wiki

Navigation

Home Page
Index
All Pages

Quick Search
»
Advanced Search »

Contributor Links

Create a new Page
Administration
File Management
Login/Logout
Your Profile

Other Wiki Sections

Software

PoweredBy

Deploying a Report via Report Server's Web Service - SSRS

RSS
Modified on Thu, Jul 08, 2010, 12:21 PM by Administrator Categorized as SSRS (SQL Server Reporting Services)
Step 1 — Add a web reference to your project to the report server's web service, naming the reference SsrsReportService. (By default, the URL to the report server's web service is http://machine-name/ReportServer/ReportService.asmx.)

Step 2 — Execute the following code.

{copytext|div1}
using System;
using System.IO;
using System.Diagnostics;
using SsrsAddIn.Model.SsrsReportService;

namespace SsrsAddIn.Model
{
    public class Engine
    {
        public static void Deploy(string localReportFile)
        {
            try
            {
                string reportNewName = Path.GetFileName(localReportFile);
                string parent = @"/"; // This is the root folder of the report server
                bool overwrite = false;
                byte[] definition = File.ReadAllBytes(localReportFile);
                Property[] properties = null;
                ReportingService rs = new ReportingService();
                rs.Credentials = System.Net.CredentialCache.DefaultCredentials;
                Warning[] warnings = (Warning[])rs.CreateReport(reportNewName, parent, overwrite, definition, properties);
                
                foreach (Warning warning in warnings)
                    Debug.Print(warning.Message);
                
            }
            catch (Exception ex)
            {
                throw ex;
            }

        }
        
    }
}

ScrewTurn Wiki version 3.0.1.400. Some of the icons created by FamFamFam. Except where noted, all contents Copyright © 1999-2018, Patrick Jasinski.