-
Notifications
You must be signed in to change notification settings - Fork 4
/
SetDataSource.rss
27 lines (23 loc) · 1022 Bytes
/
SetDataSource.rss
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
' Example:
' rs -i SetDataSource.rss -s http://localhost/ReportServer -v report="/Full/Path/To/My Report" -v reportDataSourceName="dsMySource" -v dataSource="/Full/Path/To/MyDS"
Public Sub Main()
rs.Credentials = System.Net.CredentialCache.DefaultCredentials
If not report.StartsWith("/") Then
report = "/" & report
End If
If not dataSource.StartsWith("/") Then
dataSource = "/" & dataSource
End If
SetDataSource(report, reportDataSourceName, dataSource)
End Sub
Public Sub SetDataSource(report as string, reportDataSourceName as string, dataSource as string)
Dim sources as DataSource() = rs.GetItemDataSources(report)
for each source as DataSource in sources
if source.Name.ToLower() = reportDataSourceName.ToLower() then
dim sharedReference as new DataSourceReference()
sharedReference.Reference = dataSource
source.Item = sharedReference
end if
next
rs.SetItemDataSources(report, sources)
End Sub