zoukankan      html  css  js  c++  java
  • Removing reports / report folder by SSRS (SQL SERVER REPORTING SERVICE)

    Goal :

    Remove the report folder from backstage.

    Implement Steps:

    1.       Create a C# console application project.

    2.       Add one web reference into the project. [VS2010 : http://localhost:80/ReportServer/ReportService2010.asmx]

    3.       Open the “Web References/WebServicelocalhost” folder from the project location directory and find out the “Reference.cs” file in there.

    4.       Create a new console project then add the “References. cs” as a class file,   add the web reference project as a reference.

    5.       Open the web reference project and change the internal keyword to public in the file of  \TempWebRef\TempWebRef\Properties “Settings.Designer.cs”.

    public sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {

    6.       Open the “Reference.cs” file and change the namespace to a new definitely one.

     //WebServicelocalhost

    namespace TempWebRef.LocalReportServiceRemoveGenReport { ...

    7.       Create a static private method in the “Reference.cs “ class ,it is will be better write around the “DeleteItem” default method.

     

    代码

    8.    public void DeleteItem(string Item) {
    9.                this.Invoke("DeleteItem"new object[] {
    10.                            Item});
    11.            }
    12.    
    13.            public static string DeleteReport(string _reportPath, string _reportServerURL)
    14.            {
    15.                string strReturn;
    16.                strReturn = "success";
    17.                try
    18.                {
    19.                    ReportingService2005 rs = new ReportingService2005();  // Declare one reference object .
    20.                    _reportPath = "/GenevaReports/13Report"// Naming the report path you want to remove. And if you want to remove a folder , only change the path as the main folder name like ‘/GenevaReports’
    21.                    _reportServerURL = "http://" + _reportServerURL + "/reportserver/ReportService2005.asmx"// Create the report server URL string which the reports belong to.
    22.    
    23.                    rs.Credentials = System.Net.CredentialCache.DefaultCredentials;
    24.                    rs.Url = _reportServerURL;
    25.    
    26.    
    27.                    rs.DeleteItem(_reportPath); // Call the execution.
    28.    
    29.                    return strReturn;
    30.                }
    31.                catch (Exception xe)
    32.                {
    33.    
    34.                    strReturn = xe.Message + _reportServerURL;
    35.                    return strReturn;
    36.                }
    37.    

    8.  Switch to another project and call the report deleting method like below.

    string stemp = TempWebRef.LocalReportServiceRemoveGenReport.ReportingService2005.DeleteReport("TestReport","Server3");

     

  • 相关阅读:
    UVa 128 Software CRC
    UVa 11258 String Partition(简单DP)
    POJ 3070 Fibonacci(矩阵乘法logN)
    UVa 10280 Old Wine Into New Bottles(剪枝+完全背包)
    图论笔记第四章 欧拉图与哈密尔顿图(beta.)考点
    图。。珍藏season
    图论及其应用哈密尔顿图(alpha)
    9.保健…todo
    android 移植笔记有感
    unp_exam_要点.doc
  • 原文地址:https://www.cnblogs.com/zencorn/p/1906850.html
Copyright © 2011-2022 走看看