For If You Cannot Fly (Updating Linked Report Page Settings)


I previously showed how you can programmatically set the page size properties (used by the print control) for a specific report on the server. I created an updated version of this sample that will set the page properties for all linked reports on your report server. It copies the relevant properties from the base report to the linked report. If you are using the rs.exe script host, you can delete the proxy methods at the top as they are handled automatically. This example uses the SQL 2000 RS SOAP endpoint but will work for SQL 2005 RS as well.


Dim rs As New ReportingService.ReportingService
Dim ci(), c As ReportingService.CatalogItem
Dim l As String

rs.Url = “http://localhost/reportserver/reportservice.asmx”
rs.Credentials = System.Net.CredentialCache.DefaultCredentials

ci = rs.ListChildren(“/”, True)

For Each c In ci
  If c.Type = ReportingService.ItemTypeEnum.LinkedReport Then
    Dim p(5) As ReportingService.Property

    p(0) = New ReportingService.Property
    p(0).Name = “PageHeight”

    p(1) = New ReportingService.Property
    p(1).Name = “PageWidth”

    p(2) = New ReportingService.Property
    p(2).Name = “TopMargin”

    p(3) = New ReportingService.Property
    p(3).Name = “BottomMargin”

    p(4) = New ReportingService.Property
    p(4).Name = “LeftMargin”

    p(5) = New ReportingService.Property
    p(5).Name = “RightMargin”

    l = rs.GetReportLink(c.Path)
    p = rs.GetProperties(l, p)
    rs.SetProperties(c.Path, p)
  End If
Next


Comments (6)

  1. Anonymous says:

    Thank you, this was really helpfull!

  2. Anonymous says:

    I’m sorry, but what language is this? And aren’t you the guy from Thumper?

  3. Anonymous says:

    I have application which is using Reporting Services which uses of SQL 2000 RS.

    I am planning to move to SQL 2005, in this scenario , can you suggest any plans of using Reporting Services of 2005 which makes use of the concept of SOAP End point as suggested.

    Regards,

    V

  4. bwelcker says:

    Yes, I am the guy from Thumper. Aren’t you the guy from Bitch Magnet? 🙂 This is VB.NET, btw.

    SQL 2005 Reporting Services supports the old endpoint as well as a new SOAP endpoint.