Upload XML file programmatically to SSRS server
How can I programmatically load an XSLT file into an SSRS server database? I would like exactly the same functionality as Upload File, preferably using the "rs" command.
I tried rs.CreateResource but it doesn't work for XML / XSLT files (although it does work for Excel files and images)
I understand that SSRS db manipulation is not supported. Thanks to
a source to share
Finally found the problem. The XSLT file was loaded with a null terminated byte at the end of the file. To see this, you need to use the Hex viewer.
To fix this, I copied the array into another array, minus the last character, and now everything is fine.
Dim Temp() As Byte = New Byte(ArrayLength-1) {}
For i As Integer = 0 To ArrayLength-1
Temp(i)=Contents(i)
Next
rs.CreateResource(XSLTFileName, ReportFolder, True, Temp, "application/xml", Nothing)
a source to share
This is SSMS code generated when trying to load an xml file: Dim Resource As String = "home" Dim Parent As String = "/" Dim Overwrite As Boolean = false Dim Contents () As Byte = New Byte () {} Dim MimeType As String = "text / xml" Dim Properties (-1) Like Microsoft.SqlServer.ReportingServices2005. [Property]
RS.CreateResource(Resource, Parent, Overwrite, Contents, MimeType, Properties)
Are you specifying the correct MimeType?
a source to share