我一直在玩这个没有运气的日子。基本上我试图建立一个简单的库来使用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