我一直在玩這個沒有運氣的日子。基本上我試圖建立一個簡單的庫來使用Powershell來呈現SSRS報告。我正在使用Powershell試圖稍後緩解開發(而不是爲每個項目編寫C#應用程序)。大多數情況下,這將用於安排報告的各種事情。使用Powershell中的SOAP使用參數呈現SSRS報告
我有報告渲染主要是在Powershell中工作。我無法弄清楚的一件事是如何在調用渲染方法之前向報告提供參數。我發現很多與C#和VB(我在其他SSRS項目中使用過)有關的代碼,但是我無法將其轉換爲Powershell。
由於我是Powershell的新手,我不熟悉正確的方法。下面是我一直使用的代碼:這對那些不需要參數,顯然報告工作正常
$ReportExecutionURI = "http://glitas10//ReportServer//ReportExecution2005.asmx?wsdl"
$ReportPath = "/Financial/ExpenseReportStub"
$format = "PDF"
$deviceInfo = "<DeviceInfo><NoHeader>True</NoHeader></DeviceInfo>"
$extension = ""
$mimeType = ""
$encoding = ""
$warnings = $null
$streamIDs = $null
$Reports = New-WebServiceProxy -Uri $ReportExecutionURI -UseDefaultCredential
# Load the report
$Report = $Reports.GetType().GetMethod("LoadReport").Invoke($Reports, @($ReportPath, $null))
# Render the report
$RenderOutput = $Reports.Render($format, $deviceInfo, [ref] $extension, [ref] $mimeType, [ref] $encoding, [ref] $warnings, [ref] $streamIDs)
。
有關我需要做什麼來實例化正確的對象和傳遞參數的任何想法?
爲什麼不能直接在$ Reports上調用LoadReport?當你執行這個'$ Reports |時,你會看到什麼? GET-Member'? LoadReport不顯示嗎?如果是這樣,它有什麼簽名?此外,看看這篇文章是否有所幫助 - http://social.msdn.microsoft.com/Forums/en-US/sqlreportingservices/thread/c14011bf-6d06-492e-befa-f82902a1d187/ – 2010-11-16 17:22:22
我試過了,但似乎沒有就像我提供的論據一樣。出於某種原因使用調用工作。但是,該部分起作用,並且不應該干擾提供參數。 – Matthew 2010-11-16 17:30:26
添加到我以前的評論,它出現使用$ Reports.LoadReport不會接受空的歷史ID,這就是爲什麼我發現的代碼是使用調用。 – Matthew 2010-11-16 17:50:14