Search code examples
c#.netreporting-servicesreportmanager

Upload a report file to Report manager via .net application?


I want to upload report files via c# application to the report manager.(mean Like simple Upload, select a report file and then upload selected file into report manager).
I use this sample and when i upload file an exception occurred the remote server returned an error: (401) unauthorized
** my code **

WebClient webclient = new WebClient();
webclient.UploadFile("http://server-report/Reports/Pages/", Source);

-> source refer to selected file path.
so if walking in right wayso how resolve that exception or If i not so guide me to right way?


Solution

  • you might have to use the Reporting Services Web Service to perform such operations.

    have a look at – Accessing the Reporting Services Web Service Using

    http://msdn.microsoft.com/en-us/library/aa237438%28SQL.80%29.aspx

    Edit Add a web reference to SSRS web services e.g. http://yourserver/reportservice/ReportService2005.asmx

    your code will be something like

    ReportingService2005.ReportingService2005 service = new ReportingService2005.ReportingService2005();
    
        service.CreateReport("your report","parent folder",true,<rdl byte array>,<rdl properties byte array>)
    

    Edit 2 To add web reference through Visual Studio

    1) Right click on your project

    2) select "add web reference" option

    3) enter the webservice url

    for SSRS 2008 the webservice url is the same as mentioned above