Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changing an embedded report datasource to a shared datasource #412

Open
ArnaudB88 opened this issue Oct 10, 2023 · 0 comments
Open

Changing an embedded report datasource to a shared datasource #412

ArnaudB88 opened this issue Oct 10, 2023 · 0 comments

Comments

@ArnaudB88
Copy link

Currently it is not possible to change an embedded datasource to a shared datasource reference in an existing report with the Set-RsItemDataSource function.
The code I expect to work, doesn't:

$reportServerUrl = "http://hostname/Reportserver"
$dstReportPath = "/Reports/ReportNameFoo"
$dataSourcePath = "/Datasources/DataSourceFoo"

Connect-RsReportServer -ReportServerUri $reportServerUrl -Credential $credential
$proxy = New-RsWebServiceProxy #use default connection

$newDs = New-Object ($proxy.GetType().Namespace + ".DataSource")
$newDs.Name = "NewDs"
$newDs.Item = New-Object($proxy.GetType().Namespace + ".DataSourceReference")
$newDs.Item.Reference = $dataSourcePath

Set-RsItemDataSource -ReportServerUri $reportServerUrl -RsItem $dstReportPath -DataSource $newDs

This gives the exception
Please use Set-RsDataSource to update shared data sources!

The exception is thrown in the file Set-RsItemDataSource.ps1 and is a simple check.
I don't know why this check is added, since the exception message doesn't make sense. I want to change the report datasource instead of modifying a shared datasource (which can be done with the suggested function 'Set-RsDataSource')

The bypass I use now is
$proxy.SetItemDataSources($dstReportPath, $newDs);

Question: can this check (with throwing the exception) be removed so we can use the function for the above scenario?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant