0
votes

How can I download the "RDL report files" from SQL Report Server 2008 programatically (vb.net).

I just need to download all reports and upload all back in one click event. Is this possible?

2
Out of curiosity, why? What does this accomplish? Are you editing the files programmatically then pushing them back up to the database?Shotgun Ninja
Also, have you tried anything or found any indication that this is possible in SQL Server 2008?Shotgun Ninja

2 Answers

0
votes

Several times, I have used a program called SSRSExtractor (open source). It is available on CodeProject.com http://www.codeproject.com/Articles/339744/SSRS-Downloading-RDL-Files

0
votes

I also had some code before to download reports from ssrs server

public void SaveAdhocReportsToFile()
    {
        string inputPath = "Reports";
        string outPutDir = "D:\\Reports\\";
        ExportListItemToFiles("/" + inputPath, ".rdl", outPutDir, ItemType.Report);
    }

private void ExportListItemToFiles(string inputPath, string fileExtension, string outPutFolder, string itemType)
    {
        try
        {
            Console.WriteLine("Exporting " + itemType + " from SSRS - folder " + inputPath + " to " + outPutFolder);

            string outPutFile = string.Empty;
            List<CatalogItem> items = ReportService.ListChildren(inputPath, false).Where(x => x.TypeName == itemType).ToList();


            foreach (CatalogItem item in items)
            {
                byte[] rpt_def = null;
                XmlDocument doc = new XmlDocument();

                rpt_def = ReportService.GetItemDefinition(item.Path);
                MemoryStream stream = new MemoryStream(rpt_def);

                outPutFile = string.Format(@"{0}{1}" + fileExtension, outPutFolder, item.Name);

                if (File.Exists(outPutFile))
                    File.Delete(outPutFile);

                doc.Load(stream);
                doc.Save(outPutFile);
            }
        }
        catch (SoapException ex)
        {
            throw new Exception(ex.Message);
        }
    }

You can refer to ReportingService2010 Methods: https://msdn.microsoft.com/en-us/library/reportservice2010.reportingservice2010_methods%28v=sql.120%29.aspx