Hi Borg239,
Tristan is right. I have tested the script, it only work while the data sources are in the same folder of the reports.
To store the data sources in other folders, we need to SetItemDataSources as Tristan described.
Below is a sample code for your reference:PublicSub SetDataSource() rs.Credentials = System.Net.CredentialCache.DefaultCredentialsTryDim reference AsNew DataSourceReference() reference.Reference = "/Data Sources/PDataSet"Dim source AsNew DataSource() source.Item = reference'The source name must be the data source name we used in the report. source.Name = "PDataSet"Dim sources As DataSource() = New DataSource(0) {} sources(0) = source rs.SetItemDataSources("/Reports/<report name>" , sources)Catch e As IOException Console.WriteLine(e.Message)EndTryEndSub
If you have any more questions, please feel free to ask.
Thanks,
Jin Chen
Jin Chen - MSFT
thank u :)