.net 调用ReportingService2005.FindItems()时出错;特别是关于BooleanOperatorEnum参数
在powershell v2中调用ReportingService2005.FindItems()方法时出现问题.net 调用ReportingService2005.FindItems()时出错;特别是关于BooleanOperatorEnum参数,.net,powershell,reporting-services,.net,Powershell,Reporting Services,在powershell v2中调用ReportingService2005.FindItems()方法时出现问题 $rs = New-WebServiceProxy -Uri $ReportServerUri -Namespace SSRS.ReportingService2005 -UseDefaultCredential; $searchCondition = New-Object SSRS.ReportingService2005.SearchCondition $searchCondi
$rs = New-WebServiceProxy -Uri $ReportServerUri -Namespace SSRS.ReportingService2005 -UseDefaultCredential;
$searchCondition = New-Object SSRS.ReportingService2005.SearchCondition
$searchCondition.ConditionSpecified = $true
$searchCondition.Name = "Name";
$searchCondition.Value = "Sales";
[SSRS.ReportingService2005.SearchCondition[]] $searchConditions = @($searchCondition)
$boolOp = [SSRS.ReportingService2005.BooleanOperatorEnum]::And
#Also tried bellow initialization of enum.
#[SSRS.ReportingService2005.BooleanOperatorEnum] $boolOp = 0
$rs.FindItems("/", $boolOp ,$searchConditions)
执行上述操作会产生以下错误:
无法将“FindItems”的值为“And”的参数“1”转换为类型“SSRS.ReportingService2005.BooleanOperatorEnum”:“无法将值”和“转换为类型”SSRS.ReportingService2005.BooleanOperatorEnum。错误:“从'SSRS.ReportingService2005.BooleanOperatorEnum'转换为'SSRS.ReportingService2005.BooleanOperatorEnum'无效。”
任何帮助都将不胜感激,
Zach已确定错误与我的webproxy中使用的命名空间参数有关。事实证明,我发布的脚本在会话中第一次被删除时成功运行;在同一powershell会话中连续执行时失败 我发现这篇文章很好地解释了这种情况:
$rs = New-WebServiceProxy -Uri $ReportServerUri -UseDefaultCredential;
$searchCondition = New-Object Microsoft.PowerShell.Commands.NewWebserviceProxy.AutogeneratedTypes.WebServiceProxy1er_ReportService2005_asmx_WSDL.SearchCondition;
$boolop = New-Object Microsoft.PowerShell.Commands.NewWebserviceProxy.AutogeneratedTypes.WebServiceProxy1er_ReportService2005_asmx_WSDL.BooleanOperatorEnum;