Scenario : Upload image using srrs using rs.exe (using code not GUI)
Environment : 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
Error I receive in the last line above is
The required field Property is missing from the input structure. ---> Microsoft.ReportingServices.Diagnostics.Utilities.MissingElementException: The required field Property is missing from the input structure.
What are the required parameters required in the properties object to fix the issue.
I did not find the same in CreateCatalogitem method in MSDN https://msdn.microsoft.com/en-us/library/reportservice2010.reportingservice2010.createcatalogitem(v=sql.120).aspx
Nor in the Catalog item description in MSDN
https://msdn.microsoft.com/en-us/library/reportservice2010.catalogitem.aspx
From the error message and investigation it appears ( my assumption) like a required field named 'Property' could missing from the properties array. But what would be its value?
Please share your suggestions & solutions or may be even an code alternative to rs.exe to automate deploy images to ssrs using script.