January 5, 2012 at 3:46 am
Hi,
I am trying to automate the way in which we deploy reports. I found the following code on this website and have edited it accordingly (changing report name/paths etc).
When I launch the bat file it seems to locate the .rss file, locate rs.exe and start compiling in my temp folder untill I get these two errors:
C:\Documents and Settings\My Name\Local Settings\Temp\dmakvlyl.1.vb(15):
error BC30035: Syntax error.
===========================
~
C:\Documents and Settings\My Name\Local Settings\Temp\dmakvlyl.1.vb(32):
warning BC42024: Unused local variable: 'name'.
Dim name As String
______________________________________
This is the code I have used:
Batch File
rs -i "D:\ReportsPush\PublishReports.rss" -s http://localhost/reportserver -b -v parentFolder="My Reports"
Altered RSS file
'=====================================================================
' File: PublishReports.rss
'
' Summary: Script that can be used with RS.exe to publish the
' reports that ship with Reporting Services.
'
'---------------------------------------------------------------------
' Based on the sample PublishSampleReports.rss from Microsoft
'
' Copyright (C) Microsoft Corporation. All rights reserved.
'
' This source code is intended only as a supplement to Microsoft
' Development Tools and/or on-line documentation. See these other
' materials for detailed information regarding Microsoft code samples.
'
' THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
' KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
' IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
' PARTICULAR PURPOSE.
'=====================================================================*/
Dim definition As [Byte]() = Nothing
Dim warnings As Warning() = Nothing
Dim parentPath As String = "/" + parentFolder
Dim filePath As String = "D:\ReportsPush\Reports\"
Public Sub Main()
rs.Credentials = System.Net.CredentialCache.DefaultCredentials
Dim name As String
'Publish the reports
PublishReport("Report1")
PublishReport("Report2")
End Sub
Public Sub PublishReport(ByVal reportName As String)
Try
Dim stream As FileStream = File.OpenRead(filePath + reportName + ".rdl")
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
warnings = rs.CreateReport(reportName, parentPath, True, definition, Nothing)
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
______________________________________
Can anyone help me understand why I am receiving these errors? I have checked and I have the neccesary permissions to be able to access the reports and deploy them to the location specified. I assume there is something wrong with the RSS code. If anyone with more experience could advise I'd really appreciate it.
Thanks!
January 5, 2012 at 5:50 am
I have now fixed my code. I just started from scratch and it now seems to work. Just have to figure out now how to deploy new data sources etc !!
Viewing 2 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy