Assigning Report to A Data Source Programatically
Hello, New problem I hope to resolve ASAP. I found some similar posts here but none addresses my issue. My rss script creates Shared Data Sources and deploys reports. However deployed reports either missing new data source or not being deployed because original shared data source is not found. So I decided to assign reports to correct Data Source by rs.SetItemDataSources(parentPath + ParentFolder + "/", sources). Error I'm getting and script is below. So what am I doing wrong here? If I try to create report besore SetItemDataSource I get another error that my original Data Source is missing... System.Web.Services.Protocols.SoapException: The operation you are attempting on item 'https://bi.tstsp.com/Reports/' is not allowed for this item type. ---> Microsoft.ReportingServices.Diagnostics.Utilities.WrongItemTypeExcept ion: The operation you are attempting on item 'https://bi.tstsp.com /Reports/' is not allowed for this item type. Public Sub PublishReport(ByVal reportName As String) Dim definition As [Byte]() = Nothing Try 'Dim stream As FileStream = File.OpenRead(filePath + reportName + ".rdl") Dim stream As FileStream = File.OpenRead(filePath + reportName) definition = New [Byte](stream.Length) {} stream.Read(definition, 0, CInt(stream.Length)) stream.Close() Catch e As IOException Console.WriteLine(e.Message) End Try Try Dim reference As New DataSourceReference() reference.Reference = parentPath + "DataConnections" Dim source As New DataSource() source.Item = reference source.Name = "EDW" Dim sources As DataSource() = New DataSource(0) {} sources(0) = source rs.SetItemDataSources(parentPath + ParentFolder + "/", sources) Dim warnings As Warning() = Nothing rs.CreateCatalogItem("Report",reportName, parentPath + ParentFolder + "/", True, 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("Report: {0} published successfully with no warnings", reportName) End If Catch e As Exception Console.WriteLine(e.Message) End Try End Sub
April 10th, 2012 6:50pm

This article pretty much covers it: http://www.codeproject.com/Articles/14394/Programmatically-Deploying-a-SQL-Reporting-ServiceChuck
Free Windows Admin Tool Kit Click here and download it now
April 10th, 2012 7:54pm

Chuck, Thank you for responding to my post. This article is written for SSRS 2005. I'm dealing with SSRS 2008 R2 and SharePoint integrated mode. Will ot work for that? I have RSS script written. All I need to figure out is how to assign newly deployed reports to appropriate Data Source.
April 11th, 2012 6:24pm

Unfortunately I don't know - you would have to compare the objects available between the 2005WS and 2010WSChuck
Free Windows Admin Tool Kit Click here and download it now
April 11th, 2012 6:38pm

Quick update. I figured out last problem. Assigning DataSource to a Report in RSS script looks like this: Dim warnings As Warning() = Nothing rs.CreateCatalogItem("Report",reportName, parentPath + ParentFolder + "/", True, definition, Nothing, warnings) Dim reference As New DataSourceReference() reference.Reference = parentPath + "DataConnections/EDW.rsds" Dim source As New DataSource() source.Item = reference source.Name = "EDW" Dim sources As DataSource() = New DataSource(0) {} sources(0) = source rs.SetItemDataSources(parentPath + ParentFolder + "/" + reportName, sources) Now I'm facing another issue. Some reports could not deploy using CreateCatalogItem. For some reason they complain about original Data Source. Has anyone run into this error: System.Web.Services.Protocols.SoapException: The item 'https://bi.sp.com/DataConnections/EDW.rsds' cannot be found. ---> Microsoft.ReportingService s.Diagnostics.Utilities.ItemNotFoundException: The item 'https://bi.sp.com/DataConnections/EDW.rsds' cannot be found.
April 11th, 2012 9:01pm

I think I got to the bottom of this. The reason I was getting this error is that RDL files created using Shared Data Source are hardwired to SharePoint URL: https://bi.sp.com/DataConnections/EDW.rsds whereas RDLs created using simple RDS Data Source contain no URL just GUID. If I remove or replace the URL in the RDL file RS Utility has no problem deploying it. I guess the workaround to this problem is to modify the XML in RDL file before deploying it to SharePoint server
Free Windows Admin Tool Kit Click here and download it now
April 12th, 2012 10:07am

I think I got to the bottom of this. The reason I was getting this error is that RDL files created using Shared Data Source are hardwired to SharePoint URL: https://bi.sp.com/DataConnections/EDW.rsds whereas RDLs created using simple RDS Data Source contain no URL just GUID. If I remove or replace the URL in the RDL file RS Utility has no problem deploying it. I guess the workaround to this problem is to modify the XML in RDL file before deploying it to SharePoint server
April 12th, 2012 5:03pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics