2014-10-01 225 views
0

我使用SSRS 2008.刪除SSRS報告

我需要使用我的腳本刪除我的SSRS服務器中的一些現有報告。我找不到任何關於這個的地方。我能找到的最有幫助的是herehere。兩者都沒有說明如何刪除報告。我的代碼如下。它給了我一個錯誤,說「無法找到文件」。

Public Sub Main() 
    Dim bh As New BatchHeader() 

    RS.BatchHeaderValue = bh 
    bh.BatchID = rs.CreateBatch() 
    RS.BatchHeaderValue = bh    

    RS.DeleteItem("/My Folder/My Report.rdl") 

    Try 
     RS.ExecuteBatch() 
     Console.WriteLine("Removed") 
    catch e As SoapException 
     Console.WriteLine(e.Detail.InnerXml.ToString()) 
    Finally 
     RS.BatchHeaderValue = Nothing 
    End Try 
End Sub 

任何幫助表示讚賞。

回答

2

我的不好。我包含了「.rdl」擴展名。以下是工作解決方案。

Public Sub Main() 
    Dim bh As New BatchHeader() 

    RS.BatchHeaderValue = bh 
    bh.BatchID = rs.CreateBatch() 
    RS.BatchHeaderValue = bh    

    RS.DeleteItem("/My Folder/My Report1") 
    RS.DeleteItem("/My Folder/My Report2") 
    RS.DeleteItem("/My Folder/My Report3") 

    Try 
     RS.ExecuteBatch() 
     Console.WriteLine("Removed") 
    catch e As SoapException 
     Console.WriteLine(e.Detail.InnerXml.ToString()) 
    Finally 
     RS.BatchHeaderValue = Nothing 
    End Try 
End Sub