RSS Script to deploy a single (or many) report(s) to multiple sharepoint report servers.

So I get the basics, have a script that can deploy a single report to a single server. I have other simple scripts that work as well. Now I want a script that can deploy a single report to multiple Sharepoint servers. I have about 30. I know we are probably doing this wrong, as in, we shouldn't be deploying the same report to 30 sites, as they are all all technically all on the same server however they are all independent site collections so as far as I know there is no way to deploy them to a central location and then link to them from each site. So I tried to copy elements of my single report deploy script and duplicate the Sub Main() to Sub Main1() and Sub Main2() with multiple "ParentPath1" dims, yes I know I'm stupid. That obviously didn't work. So looking at some other scripts including my own subscription updater and I'm sure I need to do some kind of "For Each item in X" but I have no idea where to start. The other lists I've seen all come from rs.Something. My list is just 30 variables in the script, how can I say for each site in this list, Publish this report?

Here's the simple script that works fine. I just don't know how to modify it to make it deploy this to multiple sites. After I figure that out, I was going to accept the challenge of deploying multiple reports to multiple sites in a single script...

Please help

Dim warnings As Warning() = Nothing
Dim parentFolder As String = "Reports"
Dim filePath As String = "filepath"
Dim reportName As String = "Report file name"
Dim parentPath As String = "Sharepoint site URL"


Public Sub Main()

  rs.Credentials = System.Net.CredentialCache.DefaultCredentials
 
  'Create the parent folder
  Try
    rs.CreateFolder(parentFolder, parentPath, Nothing)
    Console.WriteLine("Parent folder {0} created successfully", parentFolder)
  Catch e As Exception
    Console.WriteLine(e.Message)
  End Try

  'Publish the report
  PublishReport(reportName)
 
End Sub

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 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

September 8th, 2015 7:48pm

Also this is SQL 2008 R2 with SharePoint 2010
Free Windows Admin Tool Kit Click here and download it now
September 8th, 2015 7:50pm

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

Other recent topics Other recent topics