Publishing shared datasets and report parts with rs.exe
Is it possible to publish shared datasets or report parts with rs.exe? I have a set of .RSC files (report parts) and .RSD files (shared datasets) from a Report Designer project that I need to deploy to customers' report servers along with our .RDL
files and a shared datasource to be used as canned reports against our product database. I can create the shared data source and publish the .RDL files with rs.exe, but it would appear that shared datasets and report parts are not supported through the Reporting
Services Web Service. I have only found documentation on publishing shared datasets and report parts through Report Designer or Report Builder 3.0. Is there a recommended method of packaging and publishing a set of .RDL, .RDS, .RSD, and .RSC files to a report
server?
June 7th, 2010 11:47pm
I am not sure what your concern is from above you wrote; but it seems you need to deploy various report parts to report server which you can achieve by installing and using Published Report Parts feature of SQL 2008 R2. However, I am wondering it is not
supported to publish shared data sources. Below is the list you can deploy to report server:
Charts
Gauges
Images
and embedded images
Maps
Parameters
Rectangles
Tables
Matrices
Lists
--Tej
Free Windows Admin Tool Kit Click here and download it now
June 8th, 2010 12:50am
Hi MFaletra,
In SQL Server Reporting Services 2008 R2, we can use the "CreateCatalogItem" method to publish reports, shared datasources, shared datasets, and report parts. This method is included in the new endpoint--"ReportingService2010".
Below the sample for publishing report parts to report server using CreateCalalogItem method:
Dim definition As [Byte]() = Nothing
Dim warnings As Warning() = Nothing
Dim parentFolder As String = "ReportParts"
Dim parentPath As String = "/" + parentFolder
Dim filePath As String = "D:\Program Files\Microsoft SQL Server\100\Samples\Reporting Services\Script Samples\"
Public Sub Main()
rs.Credentials = System.Net.CredentialCache.DefaultCredentials
PublishReportParts("Logo")
End Sub
Public Sub PublishReportParts(ByVal reportPart As String)
Try
Dim stream As FileStream = File.OpenRead(filePath + reportPart + ".rsc")
definition = New [Byte](stream.Length - 1) {}
stream.Read(definition, 0, CInt(stream.Length))
stream.Close()
Catch e As IOException
Console.WriteLine(e.Message)
End Try
Try
Dim item As CatalogItem
item = rs.CreateCatalogItem("Component", reportPart, parentPath, False, definition, Nothing, warnings)
If Not (warnings Is Nothing) Then
Dim warning As Warning
For Each warning In warnings
Console.WriteLine(warning.Message)
Next warning
Else
Console.WriteLine("ReportPart: {0} published successfully with no warnings", reportPart)
End If
Catch e As Exception
Console.WriteLine(e.Message)
End Try
End Sub
In addition, the first parameter for CreateCatalogItem is the ItemType of the object, for a report part, the type is "Component", for a shared dataset, the type is "Dataset". Below are the supported types in SQL Server Reporting Services 2008 R2:
Unknown
Folder
Report
Resource
LinkedReport
DataSource
Model
Site
DataSet
Component
For more information about CreateCatalogItem, please see:
http://msdn.microsoft.com/en-us/library/reportservice2010.reportingservice2010.createcatalogitem.aspx
If you have any more questions, please feel free to ask.
Thanks,
Jin ChenJin Chen - MSFT
June 8th, 2010 6:47am
Hello Jin Chen,
Your answer is perfect. I was looking at the documentation for the ReportingService class, not the ReportingService2010 class. So, not surprisingly, the methods I needed were missing ;-)
An additional note to anyone reading this answer: when running RS.EXE, you need to specify the parameter "-e Mgmt2010" to use the 2010 endpoint.
Thank you so much!
Free Windows Admin Tool Kit Click here and download it now
June 10th, 2010 9:13pm
Hi
Thanks for the code you posted, but I see you do not set the data source for the shared data set, so this has to be done manually once the shared dataset has been deployed. I use the following code to set data sources in my reports, but it doesn't work for
shared datasets. Do you have any idea why? I keep getting the error "Error : rsDataSourceNotFound (The data source 'MyDataSource' cannot be found.)" even though this same data source is used by the reports and gets set correctly for them.
Dim reference As New Microsoft.SqlServer.ReportingServices2010.ItemReference()
reference.Reference = "/" & dataSourceFolder & "/" & dataSourceName
reference.Name = dataSourceName
Dim referenceArray(0) As Microsoft.SqlServer.ReportingServices2010.ItemReference
referenceArray(0) = reference
rs.SetItemReferences(fullpath, referenceArray)
June 24th, 2010 11:55am
Hi BrandonStein,
The "dataSourceName" must be the Data Source name we have defined in the report.
Please make sure, the Data Source name is 'MyDataSource'.
Thanks,
Jin ChenJin Chen - MSFT
Free Windows Admin Tool Kit Click here and download it now
June 25th, 2010 4:50am
Thanks for the reply, but I found out that the real reason is due to a discrepancy in how .rdl files and .rsd files are stored. In .rdl files you can give a name to your shared data source, which is stored in the XML as:
<DataSource Name="MyDataSourceName">
Beneath this is the reference to the shared data source:
<DataSourceReference>MyDataSource</DataSourceReference>
In a .rsd file, there is no DataSource element for the data source it references, and so no name attribute for it, only a DataSourceReference element, so when you upload a shared dataset programmatically you have to hard code the name of the shared data
source to DataSetDataSource. This is the name that then appears in Report Manager on the Data Source tab of the shared dataset (you will see it at the top in bold).
June 25th, 2010 11:24am
Hi BrandonStein,
You have to code like this:
How To Set Shared DataSource reference to Shared DataSet on SQL Server Reporting Services 2008 R2
in your case, dataSourceName should be the one defined in Shared DataSet . It is "DataSetDataSource" by default. []
Free Windows Admin Tool Kit Click here and download it now
August 14th, 2010 1:27pm
Hi Jing,
I already uploaded my shared dataset to Reporting Services and I have associated it with the data source. Then, I uploaded a report that uses the shared data set using the “CreateCatalogItem”
method but when I executed the report in Reporting Services I got the following error:
An internal error occurred on the report server. See the error log for more details. (rsInternalError)
Get Online Help
Object reference not set to an instance of an object.
Do you know if it is necessary to link the shared dataset and the report? How can I do that?
Thank you in advance!
Pablo
January 3rd, 2011 12:15pm