.Net(C#)SSRS(rdl)文件未从C:\导入到ReportServer

时间:2016-11-03 14:46:02

标签: c# .net reporting-services

您看到的代码来自MSDN。在测试时,它表示SOURCE的无效路径。我同意。他们希望源是另一个Reporting Server中的URL。但是,我需要能够将RDL文件从我的C:\复制到报表服务器。我怎么能?

    static void move_report(string currentPath, string targetPath )
    {

        ReportingService2010 service = new ReportingService2010();
        ReportingService2010 rs = new ReportingService2010();

        rs.Url = "http://MHPDW2/ReportServer/" + "ReportService2010.asmx";
        rs.Credentials = System.Net.CredentialCache.DefaultCredentials;


        try
        {
            rs.MoveItem(currentPath, targetPath);
        }

        catch (SoapException e)
        {
            Console.WriteLine(e.Detail.OuterXml);
        }
    }


    static void Main(string[] args)
    {

        string currentPath = "H:\\ITTFS2012\\SSRS\\DW15Reports\\Claims\\6.1 universe.rdl";
        string targetPath = "http://MHPDW2/ReportServer/MidwestHealthPlan/Claims/HPMS/MCR Plan Code/H5685 2014 HPMS/";

        move_report(currentPath,targetPath);

2 个答案:

答案 0 :(得分:0)

" H:\"驱动解析并且您是否有权访问源位置?

答案 1 :(得分:0)

小组: 我找到了答案。一切都在这里(包括代码) 我不得不使用rs.CreateCatalogItem方法。

https://msdn.microsoft.com/en-us/library/reportservice2010.reportingservice2010.createcatalogitem.aspx