我遇到了以下代码:
cls;
#Set variables:
$reportserver = "myServer";
$newDataSourcePath = "/Data Sources/MyDS"
$newDataSourceName = "MyDS";
$reportFolderPath = "/DH"
#------------------------------------------------------------------------
$ssrs = New-WebServiceProxy -uri $url -UseDefaultCredential
$reports = $ssrs.ListChildren($reportFolderPath, $false)
$reports | ForEach-Object {
$reportPath = $_.path
Write-Host "Report: " $reportPath
$dataSources = $ssrs.GetItemDataSources($reportPath)
$dataSources | ForEach-Object {
$proxyNamespace = $_.GetType().Namespace
$myDataSource = New-Object ("$proxyNamespace.DataSource")
$myDataSource.Name = $newDataSourceName
$myDataSource.Item = New-Object ("$proxyNamespace.DataSourceReference")
$myDataSource.Item.Reference = $newDataSourcePath
$_.item = $myDataSource.Item
$ssrs.SetItemDataSources($reportPath, $_)
Write-Host "Report's DataSource Reference ($($_.Name)): $($_.Item.Reference)"
}
Write-Host "------------------------"
}
问题在于数据源显示名称没有更改。因此,数据源的名称确实可以使用,但名称不会更改。 我想念什么?