Pro SQL Server 2012 Reporting Services

(sharon) #1
CHAPTER 8  DEPLOYING REPORTS


  • Folder: The name of the folder to be created

  • Parent: The parent name of the folder that you are creating

  • Properties: An array of Property[] objects that hold property names and values for
    the new folder


The main function in the RSS file is calling three internal functions, one that utilizes the
CreateFolder method, one that utilizes the CreateDataSource method, and one that utilizes the
CreateReport method. You can use these three functions to create more folders and data sources or
deploy more reports depending on your needs. In this example, we call all three functions once, but you
can modify this file to deploy any number of reports or data sources that you need. You can see the full
code for the RSS file in Listing 8-2.


Listing 8-2. RSS File Contents


Dim parentPath As String = "Pro_SSRS/Chapter 8"
Dim reportPath As String = "C:\PRO_SSRS\Chapter 8\RS\"


Public Sub Main()


' Initialize the reporting services credentials
rs.Credentials = System.Net.CredentialCache.DefaultCredentials


' Pass our path information to create the folder structure
CreateFolder(parentPath, "/")


' Pass our data source information to the create data source function
CreateDataSource("Pro_SSRS", "SQL", "data source=(local);initial catalog=Pro_SSRS")


' Pass our report name to the deploy report function
DeployReport("EmployeeServiceCost")


End Sub


Public Sub CreateDataSource(name As String, extension As String, connectionString As String)
' Define the data source definition.
Dim dataSourceDefinition As New DataSourceDefinition()


dataSourceDefinition.CredentialRetrieval = CredentialRetrievalEnum.Integrated
dataSourceDefinition.ConnectString = connectionString
dataSourceDefinition.Enabled = True
dataSourceDefinition.EnabledSpecified = True
dataSourceDefinition.Extension = extension
dataSourceDefinition.ImpersonateUser = False
dataSourceDefinition.ImpersonateUserSpecified = True


'Use the default prompt string.
dataSourceDefinition.Prompt = Nothing
dataSourceDefinition.WindowsCredentials = False

Free download pdf