场景:使用 rs.exe 使用 srrs 上传图像(使用代码而不是 GUI)
环境:Sql server 2012, rs.exe , vb.script
'Utility to Publish the Png file ( snippet)
'Sample inputs PublishImageFile("myimagefilename.png", "image/png")
Public Sub PublishImageFile(ByVal imageName As String,ByVal resourceMIME As String)
Try
Dim stream As FileStream = File.OpenRead(filePath + "\" + imageName)
definition = New [Byte](stream.Length - 1) {}
stream.Read(definition, 0, CInt(stream.Length))
stream.Close()
Catch e As IOException
Console.WriteLine(e.Message)
End Try
imageName = imageName.tostring.replace(".png", "")
Console.WriteLine("Attempting to Deploy Resource Name {0}", imageName.tostring)
Dim item As CatalogItem
Dim mimeProperty As New Microsoft.SqlServer.ReportingServices2010.Property
mimeProperty.Name = "MimeType"
mimeProperty.Value = resourceMIME
Dim properties(1) As Microsoft.SqlServer.ReportingServices2010.Property
properties(0) = mimeProperty
Try
item = rs.CreateCatalogItem("Resource", imageName, ReportFolder, True,
definition, properties, warnings) 'Error line
'More code below removed for brevity
我在上面最后一行收到的错误是
输入结构中缺少必填字段属性。---> Microsoft.ReportingServices.Diagnostics.Utilities.MissingElementException:输入结构中缺少必填字段属性。
属性对象中解决问题所需的参数是什么。
我在 MSDN https://msdn.microsoft.com/en-us/library/reportservice2010.reportingservice2010.createcatalogitem(v=sql.120).aspx的 CreateCatalogitem 方法中没有找到相同的
也不在 MSDN 的目录项描述中
https://msdn.microsoft.com/en-us/library/reportservice2010.catalogitem.aspx
从错误消息和调查来看(我的假设),属性数组中可能缺少名为“Property”的必填字段。但它的价值是什么?
请分享您的建议和解决方案,或者甚至可能是 rs.exe 的代码替代品,以使用脚本自动将图像部署到 ssrs。