reporting-services - 如何通过 .bat 或 .rss 在 SSRS 中创建新文件夹?
问题描述
我有一个脚本,可以将许多 .RDL 文件上传到 SSRS 报告服务器。但是,它不考虑它要进入的文件夹是否丢失。我正在尝试安排它来创建该文件夹,但旧的 vbscript CreateObject 选项不起作用,并且基于报表数据库目录表具有的字段,我认为使用它不是一个选项。
我当前的 .rss,由批处理脚本通过 RS.exe 调用:
Public Sub Main()
Dim region As String = REGION
Dim fLoc As String = FILELOCATION
Dim folder As String = PARENTFOLDER
Dim name As String = RDLNAME
Dim data As String = DATASOURCE
Dim parent As String = "/" + folder
Dim location As String = fLoc + "\" + name + ".rdl"
Dim overwrite As Boolean = True
Dim reportContents As Byte() = Nothing
Dim warnings As Warning() = Nothing
Dim fullpath As String = parent + "/" + name
'Common CatalogItem properties
Dim descprop As New [Property]
descprop.Name = "Description"
descprop.Value = ""
Dim hiddenprop As New [Property]
hiddenprop.Name = "Hidden"
hiddenprop.Value = "False"
Dim props(1) As [Property]
props(0) = descprop
props(1) = hiddenprop
'Read RDL definition from disk
Try
Dim stream As FileStream = File.OpenRead(location)
reportContents = New [Byte](stream.Length-1) {}
stream.Read(reportContents, 0, CInt(stream.Length))
stream.Close()
warnings = RS.CreateReport(name, parent, overwrite, reportContents, props)
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", name)
End If
'Set report DataSource references
'Dim dataSources(0) As DataSource
'Dim dsr0 As New DataSourceReference
'dsr0.Reference = region + "/MyDataSource"
'Dim ds0 As New DataSource
'ds0.Item = CType(dsr0, DataSourceDefinitionOrReference)
'ds0.Name = data
'dataSources(0) = ds0
'RS.SetItemDataSources(fullpath, dataSources)
'Console.Writeline("Report DataSources set successfully")
Console.WriteLine("Report: {0} published successfully", name)
Catch e As IOException
Console.WriteLine(e.Message)
Catch e As SoapException
Console.WriteLine("Error : " + e.Detail.Item("ErrorCode").InnerText + " (" + e.Detail.Item("Message").InnerText + ")")
Console.WriteLine("Report: {0} published with error", name)
End Try
结束子
解决方案
推荐阅读
- android - BLE:如何发送写请求而不是写命令?
- reactjs - redux 的类型 / 像装饰器一样连接
- asp.net-mvc - 从外部类返回视图
- javascript - 在具有特定键的特定值的数组中查找对象的索引
- wix - 您如何在每次启动时检测已安装的产品版本?
- facebook - Facebook JS SDK 和分享按钮错误
- intellij-idea - IntelliJ Ultimate 无法从 SAP PI WSDL 文件生成代码
- pandas - 熊猫分组并从列表的行转换为大文件的列(无转置)
- jsp - 通过自定义标签从 JSP 获取应用程序字段
- autodesk-forge - 有没有办法知道 Forge API 中文件夹何时有子文件夹?