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