SQL Server Reporting Services - playing with the released bits

In feedback of my previous blog, Thomas asked:

Mike - I remember some review of this thing talking about it not being programmable with C# or VB.NET. Did you see anything in regards to that?

Yes and no...

You work with report definitions in VS.NET - there are new project templates for building reports.

The VS.NET integration consists of a visual designer for the RDF file, which is in pure XML format. The RDF gets published to the Report Server (via http) and available to clients by navigating to the report server website (http://localhost/ReportServer). There is no "code view" when working in a report project, except for the XML view of the RDF. Its not like an ASP.NET page, there is no VB.NET or C# code-behind file for the report.

Ok, so can I program a report through a C# or VB.NET project? Uh, well, kinda the same answer - yes and no. When I created a new C# project and went to add a reference, there was no Microsoft.ReportingService object space listed in the GAC. I did browse to the assemblies in C:\Program Files\Microsoft SQL Server\MSSQL\Reporting Services\ReportServer\bin\ and added a reference to ReportingServicesLibrary.dll (there was a ton of other assemblies there too, this seemed like the most likely candidate. The object browser shows a bunch of classes in the namespaces Microsoft.ReportingServices.Library and Microsoft.ReportingServices.Library.Soap. I'm not sure that is where I would start if I wanted to program these things.

More useful was adding a web reference to http://localhost/ReportServer/ReportService.asmx - the WSDL shows this:

"ReportingService" Description

Documentation

The Reporting Services Web Service enables you to manage a report server and its contents including server settings, security, reports, subscriptions, and data sources.

Methods

  • CancelBatch()
  • CancelJob(JobID As string) As boolean
  • CreateBatch() As string
  • CreateDataDrivenSubscription(Report As stringExtensionSettings As ExtensionSettingsDataRetrievalPlan As DataRetrievalPlanDescription As stringEventType As stringMatchData As stringParameters As ArrayOfParameterValueOrFieldReference) As string
  • CreateDataSource(DataSource As stringParent As stringOverwrite As booleanDefinition As DataSourceDefinitionProperties As ArrayOfProperty)
  • CreateFolder(Folder As stringParent As stringProperties As ArrayOfProperty)
  • CreateLinkedReport(Report As stringParent As stringLink As stringProperties As ArrayOfProperty)
  • CreateReport(Report As stringParent As stringOverwrite As booleanDefinition As base64BinaryProperties As ArrayOfProperty) As ArrayOfWarning
  • CreateReportHistorySnapshot(Report As string) As string
  • CreateResource(Resource As stringParent As stringOverwrite As booleanContents As base64BinaryMimeType As stringProperties As ArrayOfProperty)
  • CreateRole(Name As stringDescription As stringTasks As ArrayOfTask)
  • CreateSchedule(Name As stringScheduleDefinition As ScheduleDefinition) As string
  • CreateSubscription(Report As stringExtensionSettings As ExtensionSettingsDescription As stringEventType As stringMatchData As stringParameters As ArrayOfParameterValue) As string
  • DeleteItem(Item As string)
  • DeleteReportHistorySnapshot(Report As stringHistoryID As string)
  • DeleteRole(Name As string)
  • DeleteSchedule(ScheduleID As string)
  • DeleteSubscription(SubscriptionID As string)
  • DisableDataSource(DataSource As string)
  • EnableDataSource(DataSource As string)
  • ExecuteBatch()
  • FindItems(Folder As stringBooleanOperator As BooleanOperatorEnumConditions As ArrayOfSearchCondition) As ArrayOfCatalogItem
  • FireEvent(EventType As stringEventData As string)
  • FlushCache(Report As string)
  • GetCacheOptions(Report As string) As boolean
  • GetDataDrivenSubscriptionProperties(DataDrivenSubscriptionID As string) As string
  • GetDataSourceContents(DataSource As string) As DataSourceDefinition
  • GetExecutionOptions(Report As string) As ExecutionSettingEnum
  • GetExtensionSettings(Extension As string) As ArrayOfExtensionParameter
  • GetItemType(Item As string) As ItemTypeEnum
  • GetPermissions(Item As string) As ArrayOfString3
  • GetPolicies(Item As string) As ArrayOfPolicy
  • GetProperties(Item As stringProperties As ArrayOfProperty) As ArrayOfProperty
  • GetRenderResource(Format As stringDeviceInfo As string) As base64Binary
  • GetReportDataSourcePrompts(Report As string) As ArrayOfDataSourcePrompt
  • GetReportDataSources(Report As string) As ArrayOfDataSource
  • GetReportDefinition(Report As string) As base64Binary
  • GetReportHistoryLimit(Report As string) As int
  • GetReportHistoryOptions(Report As string) As boolean
  • GetReportLink(Report As string) As string
  • GetReportParameters(Report As stringHistoryID As stringForRendering As booleanValues As ArrayOfParameterValueCredentials As ArrayOfDataSourceCredentials) As ArrayOfReportParameter
  • GetResourceContents(Resource As string) As base64Binary
  • GetRoleProperties(Name As string) As ArrayOfTask
  • GetScheduleProperties(ScheduleID As string) As Schedule
  • GetSubscriptionProperties(SubscriptionID As string) As string
  • GetSystemPermissions() As ArrayOfString3
  • GetSystemPolicies() As ArrayOfPolicy
  • GetSystemProperties(Properties As ArrayOfProperty) As ArrayOfProperty
  • InheritParentSecurity(Item As string)
  • ListChildren(Item As stringRecursive As boolean) As ArrayOfCatalogItem
  • ListEvents() As ArrayOfEvent
  • ListExtensions(ExtensionType As ExtensionTypeEnum) As ArrayOfExtension
  • ListJobs() As ArrayOfJob
  • ListLinkedReports(Report As string) As ArrayOfCatalogItem
  • ListReportHistory(Report As string) As ArrayOfReportHistorySnapshot
  • ListReportsUsingDataSource(DataSource As string) As ArrayOfCatalogItem
  • ListRoles() As ArrayOfRole
  • ListScheduledReports(ScheduleID As string) As ArrayOfCatalogItem
  • ListSchedules() As ArrayOfSchedule
  • ListSecureMethods() As ArrayOfString
  • ListSubscriptions(Report As stringOwner As string) As ArrayOfSubscription
  • ListSubscriptionsUsingDataSource(DataSource As string) As ArrayOfSubscription
  • ListSystemRoles() As ArrayOfRole
  • ListSystemTasks() As ArrayOfTask
  • ListTasks() As ArrayOfTask
  • Logoff()
  • LogonUser(userName As stringpassword As stringauthority As string)
  • MoveItem(Item As stringTarget As string)
  • PauseSchedule(ScheduleID As string)
  • PrepareQuery(DataSource As DataSourceDataSet As DataSetDefinition) As DataSetDefinition
  • Render(Report As stringFormat As stringHistoryID As stringDeviceInfo As stringParameters As ArrayOfParameterValueCredentials As ArrayOfDataSourceCredentialsShowHideToggle As string) As base64Binary
  • RenderStream(Report As stringFormat As stringStreamID As stringHistoryID As stringDeviceInfo As stringParameters As ArrayOfParameterValue) As base64Binary
  • ResumeSchedule(ScheduleID As string)
  • SetCacheOptions(Report As stringCacheReport As boolean)
  • SetDataDrivenSubscriptionProperties(DataDrivenSubscriptionID As stringExtensionSettings As ExtensionSettingsDataRetrievalPlan As DataRetrievalPlanDescription As stringEventType As stringMatchData As stringParameters As ArrayOfParameterValueOrFieldReference)
  • SetDataSourceContents(DataSource As stringDefinition As DataSourceDefinition)
  • SetExecutionOptions(Report As stringExecutionSetting As ExecutionSettingEnum)
  • SetPolicies(Item As stringPolicies As ArrayOfPolicy)
  • SetProperties(Item As stringProperties As ArrayOfProperty)
  • SetReportDataSources(Report As stringDataSources As ArrayOfDataSource)
  • SetReportDefinition(Report As stringDefinition As base64Binary) As ArrayOfWarning
  • SetReportHistoryLimit(Report As stringUseSystem As booleanHistoryLimit As int)
  • SetReportHistoryOptions(Report As stringEnableManualSnapshotCreation As booleanKeepExecutionSnapshots As boolean)
  • SetReportLink(Report As stringLink As string)
  • SetReportParameters(Report As stringParameters As ArrayOfReportParameter)
  • SetResourceContents(Resource As stringContents As base64BinaryMimeType As string)
  • SetRoleProperties(Name As stringDescription As stringTasks As ArrayOfTask)
  • SetScheduleProperties(Name As stringScheduleID As stringScheduleDefinition As ScheduleDefinition)
  • SetSubscriptionProperties(SubscriptionID As stringExtensionSettings As ExtensionSettingsDescription As stringEventType As stringMatchData As stringParameters As ArrayOfParameterValue)
  • SetSystemPolicies(Policies As ArrayOfPolicy)
  • SetSystemProperties(Properties As ArrayOfProperty)
  • UpdateReportExecutionSnapshot(Report As string)
  • ValidateExtensionSettings(Extension As stringParameterValues As ArrayOfParameterValueOrFieldReference) As ArrayOfExtensionParameter

This is likely where I would start to programmatically create reports.

Anyway, the first report I tried was a matrix report (like an Access cross-tab). The wizard was pretty straight forward, but I've done cross-tabs before using Access, so I knew what to expect I guess. It turned out that I used Guids as the row and column headers, which was something it didn't like (gave a runtime error), because I didn't know how to add the lookup tables to the query (in the wizard). Once I modified the datasource and joined in the lookup tables, then I was able to use the descriptive column rather than the Guid as the row header and column header. Actually figuring out what property sheets allowed me to do that was tougher - I was getting compile errors and double-clicking on the task didn't bring up any property sheet. Eventually I was able to get it, and ran the report, and got some good results. With drill-down.

And then it hung. Not sure why or what exactly happened, but VS.NET wouldn't shut down. Anyway, when I fired it back up again, it worked no problem. So it could have been me.

So far, I like it.

Mike

1 Comment

Comments have been disabled for this content.