很多朋友都用过reporting service,以及使用有关工具制作报表(文件格式为rdl),通常情况下,这些报表需要部署到报表服务器,然后再统一访问。当报表比较多的时候,我们自然而然地会想,是否有什么方法批量上传报表么?答案是肯定的。
第一种方式,可以使用reporting service自带的一个rs的工具,通过提供一个脚本文件(扩展名为rss),就可以实现该需求。微软提供了一个范例如下
C:\Program Files\Microsoft SQL Server\90\Samples\Reporting Services\Script Samples\PublishSampleReports.rss
大致的脚本和使用方式如下
可以看出,这些所谓的脚本是用VB.NET编写的。其实就是.NET编程,但因为它是所谓脚本的方式,反倒有些地方不是很自然了。例如代码中的rs在哪里定义的,是什么类型呢?我的理解是这个rs其实就是指向了reporting service所提供的那些web service。但是的确有点费解。
![ContractedBlock.gif](https://www.cnblogs.com/Images/OutliningIndicators/ContractedBlock.gif)
![ExpandedBlockStart.gif](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockStart.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![ExpandedBlockStart.gif](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockStart.gif)
![ContractedBlock.gif](https://www.cnblogs.com/Images/OutliningIndicators/ContractedBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockEnd.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![ExpandedBlockStart.gif](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockStart.gif)
![ContractedBlock.gif](https://www.cnblogs.com/Images/OutliningIndicators/ContractedBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockEnd.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![ExpandedBlockStart.gif](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockStart.gif)
![ContractedBlock.gif](https://www.cnblogs.com/Images/OutliningIndicators/ContractedBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/InBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockEnd.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
第二种方式,自己编写一个工具来完成更加丰富的控制。这里可以用任何的语言,只要你熟悉即可。
这里的关键在于,添加对reporting service的web service的引用。下面是它所有的方法
"ReportingService2005" 说明
文档
The Reporting Services Web Service enables you to manage a report server and its contents including server settings, security, reports, subscriptions, and data sources.
方法
- CancelBatch ( )
- CancelJob ( JobID As string ) As boolean
- CreateBatch ( ) As string
- CreateDataDrivenSubscription ( Report As string , ExtensionSettings As ExtensionSettings , DataRetrievalPlan As DataRetrievalPlan , Description As string , EventType As string , MatchData As string , Parameters As ArrayOfParameterValueOrFieldReference ) As string
- CreateDataSource ( DataSource As string , Parent As string , Overwrite As boolean , Definition As DataSourceDefinition , Properties As ArrayOfProperty )
- CreateFolder ( Folder As string , Parent As string , Properties As ArrayOfProperty )
- CreateLinkedReport ( Report As string , Parent As string , Link As string , Properties As ArrayOfProperty )
- CreateModel ( Model As string , Parent As string , Definition As base64Binary , Properties As ArrayOfProperty ) As ArrayOfWarning
- CreateReport ( Report As string , Parent As string , Overwrite As boolean , Definition As base64Binary , Properties As ArrayOfProperty ) As ArrayOfWarning
- CreateReportHistorySnapshot ( Report As string ) As string
- CreateResource ( Resource As string , Parent As string , Overwrite As boolean , Contents As base64Binary , MimeType As string , Properties As ArrayOfProperty )
- CreateRole ( Name As string , Description As string , Tasks As ArrayOfTask )
- CreateSchedule ( Name As string , ScheduleDefinition As ScheduleDefinition ) As string
- CreateSubscription ( Report As string , ExtensionSettings As ExtensionSettings , Description As string , EventType As string , MatchData As string , Parameters As ArrayOfParameterValue ) As string
- DeleteItem ( Item As string )
- DeleteReportHistorySnapshot ( Report As string , HistoryID 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 string , BooleanOperator As BooleanOperatorEnum , Conditions As ArrayOfSearchCondition ) As ArrayOfCatalogItem
- FireEvent ( EventType As string , EventData As string )
- FlushCache ( Report As string )
- GenerateModel ( DataSource As string , Model As string , Parent As string , Properties As ArrayOfProperty ) As ArrayOfWarning
- 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
- GetItemDataSourcePrompts ( Item As string ) As ArrayOfDataSourcePrompt
- GetItemDataSources ( Item As string ) As ArrayOfDataSource
- GetItemType ( Item As string ) As ItemTypeEnum
- GetModelDefinition ( Model As string ) As base64Binary
- GetModelItemPermissions ( Model As string , ModelItemID As string ) As ArrayOfString
- GetModelItemPolicies ( Model As string , ModelItemID As string ) As ArrayOfPolicy
- GetPermissions ( Item As string ) As ArrayOfString3
- GetPolicies ( Item As string ) As ArrayOfPolicy
- GetProperties ( Item As string , Properties As ArrayOfProperty ) As ArrayOfProperty
- GetRenderResource ( Format As string , DeviceInfo As string ) As base64Binary
- 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 string , HistoryID As string , ForRendering As boolean , Values As ArrayOfParameterValue , Credentials 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
- GetUserModel ( Model As string , Perspective As string ) As base64Binary
- InheritModelItemParentSecurity ( Model As string , ModelItemID As string )
- InheritParentSecurity ( Item As string )
- ListChildren ( Item As string , Recursive As boolean ) As ArrayOfCatalogItem
- ListDependentItems ( Item As string ) As ArrayOfCatalogItem
- ListEvents ( ) As ArrayOfEvent
- ListExtensions ( ExtensionType As ExtensionTypeEnum ) As ArrayOfExtension
- ListJobs ( ) As ArrayOfJob
- ListModelDrillthroughReports ( Model As string , ModelItemID As string ) As ArrayOfModelDrillthroughReport
- ListModelItemChildren ( Model As string , ModelItemID As string , Recursive As boolean ) As ArrayOfModelItem
- ListModelPerspectives ( Model As string ) As ArrayOfModelCatalogItem
- ListReportHistory ( Report As string ) As ArrayOfReportHistorySnapshot
- ListRoles ( SecurityScope As SecurityScopeEnum ) As ArrayOfRole
- ListScheduledReports ( ScheduleID As string ) As ArrayOfCatalogItem
- ListSchedules ( ) As ArrayOfSchedule
- ListSecureMethods ( ) As ArrayOfString
- ListSubscriptions ( Report As string , Owner As string ) As ArrayOfSubscription
- ListSubscriptionsUsingDataSource ( DataSource As string ) As ArrayOfSubscription
- ListTasks ( SecurityScope As SecurityScopeEnum ) As ArrayOfTask
- Logoff ( )
- LogonUser ( userName As string , password As string , authority As string )
- MoveItem ( Item As string , Target As string )
- PauseSchedule ( ScheduleID As string )
- PrepareQuery ( DataSource As DataSource , DataSet As DataSetDefinition ) As DataSetDefinition
- RegenerateModel ( Model As string ) As ArrayOfWarning
- RemoveAllModelItemPolicies ( Model As string )
- ResumeSchedule ( ScheduleID As string )
- SetCacheOptions ( Report As string , CacheReport As boolean )
- SetDataDrivenSubscriptionProperties ( DataDrivenSubscriptionID As string , ExtensionSettings As ExtensionSettings , DataRetrievalPlan As DataRetrievalPlan , Description As string , EventType As string , MatchData As string , Parameters As ArrayOfParameterValueOrFieldReference )
- SetDataSourceContents ( DataSource As string , Definition As DataSourceDefinition )
- SetExecutionOptions ( Report As string , ExecutionSetting As ExecutionSettingEnum )
- SetItemDataSources ( Item As string , DataSources As ArrayOfDataSource )
- SetModelDefinition ( Model As string , Definition As base64Binary ) As ArrayOfWarning
- SetModelDrillthroughReports ( Model As string , ModelItemID As string , Reports As ArrayOfModelDrillthroughReport )
- SetModelItemPolicies ( Model As string , ModelItemID As string , Policies As ArrayOfPolicy )
- SetPolicies ( Item As string , Policies As ArrayOfPolicy )
- SetProperties ( Item As string , Properties As ArrayOfProperty )
- SetReportDefinition ( Report As string , Definition As base64Binary ) As ArrayOfWarning
- SetReportHistoryLimit ( Report As string , UseSystem As boolean , HistoryLimit As int )
- SetReportHistoryOptions ( Report As string , EnableManualSnapshotCreation As boolean , KeepExecutionSnapshots As boolean )
- SetReportLink ( Report As string , Link As string )
- SetReportParameters ( Report As string , Parameters As ArrayOfReportParameter )
- SetResourceContents ( Resource As string , Contents As base64Binary , MimeType As string )
- SetRoleProperties ( Name As string , Description As string , Tasks As ArrayOfTask )
- SetScheduleProperties ( Name As string , ScheduleID As string , ScheduleDefinition As ScheduleDefinition )
- SetSubscriptionProperties ( SubscriptionID As string , ExtensionSettings As ExtensionSettings , Description As string , EventType As string , MatchData As string , Parameters As ArrayOfParameterValue )
- SetSystemPolicies ( Policies As ArrayOfPolicy )
- SetSystemProperties ( Properties As ArrayOfProperty )
- UpdateReportExecutionSnapshot ( Report As string )
- ValidateExtensionSettings ( Extension As string , ParameterValues As ArrayOfParameterValueOrFieldReference ) As ArrayOfExtensionParameter
最后我开发的一个自己使用的小工具,如图所示。
该工具可以对一个目录下,所有报表以及数据源进行上传(可以递归子文件夹),同时整个程序是多线程的。