Send SSRS report to sharepoint using SSIS

  • Hi,

    I just want to inquire how can do this task.

    Generate SSRS report and send the generated report to sharepoint site using SSIS.

    A working code will be a great help.

    Thank you.

  • Hi,

    Here is the code that I used.

    Imports System

    Imports System.Data

    Imports System.Math

    Imports Microsoft.SqlServer.Dts.Runtime

    Imports System.ComponentModel

    Imports System.Diagnostics

    <Microsoft.SqlServer.Dts.Tasks.ScriptTask.SSISScriptTaskEntryPointAttribute()> _

    <System.CLSCompliantAttribute(False)> _

    Partial Public Class ScriptMain

    Inherits Microsoft.SqlServer.Dts.Tasks.ScriptTask.VSTARTScriptObjectModelBase

    Enum ScriptResults

    Success = Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Success

    Failure = Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Failure

    End Enum

    Protected Sub SaveFile(ByVal url As String, ByVal localpath As String)

    Dim loRequest As System.Net.HttpWebRequest

    Dim loResponse As System.Net.HttpWebResponse

    Dim loResponseStream As System.IO.Stream

    Dim loFileStream As New System.IO.FileStream(localpath, System.IO.FileMode.Create, System.IO.FileAccess.Write)

    Dim laBytes(256) As Byte

    Dim liCount As Integer = 1

    Try

    loRequest = CType(System.Net.WebRequest.Create(url), System.Net.HttpWebRequest)

    loRequest.Credentials = System.Net.CredentialCache.DefaultCredentials

    loRequest.Timeout = 600000

    loRequest.Method = "GET"

    loResponse = CType(loRequest.GetResponse, System.Net.HttpWebResponse)

    loResponseStream = loResponse.GetResponseStream

    Do While liCount > 0

    liCount = loResponseStream.Read(laBytes, 0, 256)

    loFileStream.Write(laBytes, 0, liCount)

    Loop

    loFileStream.Flush()

    loFileStream.Close()

    Catch ex As Exception

    End Try

    End Sub

    Public Sub Main()

    Dim url, destination As String

    destination = Dts.Variables("Folder_Destination").Value.ToString + "\" + "Report_" + Dts.Variables("ReportParameter").Value.ToString + "_" + Format(Now, "yyyyMMdd") + ".xls"

    url = "http://localhost:8080/ReportServer?/MyReports/SSIS_Execute_SSRS_Report&rs:Command=Render&Productkey=" + Dts.Variables("ReportParameter").Value.ToString + "&rs:Format=EXCEL"

    SaveFile(url, destination)

    Dts.TaskResult = ScriptResults.Success

    End Sub

    End Class

    The report was sent to a local folder.

    What I want is the destination should be a sharepoint site.

    Please advise.

    Thank you very much.

  • Any feedback guys?

    Need your help about this.

    Thank you.

  • Hi,

    No coding effort is required for posting SSRS reports to SharePoint. There is a subscription server available in SSRS, which you can schedule to generate and deliver a report to email / share drive / share point.

    Refer the below links,

    1. https://msdn.microsoft.com/en-us/library/bb283155.aspx

    2. https://technet.microsoft.com/en-us/library/cc872783.aspx

    3. http://smallbusiness.chron.com/displaying-ssrs-report-sharepoint-35384.html

    (I suggest you to search for more links)

    You can directly deploy SSRS reports to sharepoint as well

    Regards,

    Vijay

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply