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

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;
            }

        }
        
    }
}