none
setup many subscriptions

    Question

  • one report and may be around 40 subscriptions for it

    just copy-paste email, body of letter, subject

     

    new report, again the same 40 subscriptions, the same email, new subject, new body

     

    is it way to build any scripts to avoid this boring job ?

    • Edited by ArtemB Thursday, July 02, 2009 5:33 AM
    Thursday, July 02, 2009 5:33 AM

Answers

  • Hi ArtemB,

     

    I would suggest using a script file and the rs script utility to create the subscription.

     

    Here is a sample script for your reference:

    Public Sub Main()
          rs.Credentials = System.Net.CredentialCache.DefaultCredentials
     
          Dim report As String = "/AdventureWorks Sample Reports/Employee Sales Summary"
          Dim desc As String = "v-jc@microsoft.com"
          Dim eventType As String = "TimedSubscription"
          Dim scheduleXml As String = "<ScheduleDefinition><StartDateTime>2009-04-24T09:00:00-08:00</StartDateTime><WeeklyRecurrence><WeeksInterval>1</WeeksInterval><DaysOfWeek><Monday>True</Monday></DaysOfWeek></WeeklyRecurrence></ScheduleDefinition>"
     
          Dim extensionParams(7) As ParameterValue
     
          extensionParams(0) = New ParameterValue()
          extensionParams(0).Name = "TO"
          extensionParams(0).Value = "v-jc@microsoft.com"
     
          extensionParams(1) = New ParameterValue()
          extensionParams(1).Name = "ReplyTo"
          extensionParams(1).Value = "v-jc@microsoft.com"
     
          extensionParams(2) = New ParameterValue()
          extensionParams(2).Name = "IncludeReport"
          extensionParams(2).Value = "True"
     
          extensionParams(3) = New ParameterValue()
          extensionParams(3).Name = "RenderFormat"
          extensionParams(3).Value = "MHTML"
     
          extensionParams(4) = New ParameterValue()
          extensionParams(4).Name = "Subject"
          extensionParams(4).Value = "@ReportName was executed at @ExecutionTime"
     
          extensionParams(5) = New ParameterValue()
          extensionParams(5).Name = "Comment"
          'extensionParams(5).Value = "Here is your daily sales report for Michael."
          extensionParams(5).Value = "Dear Custome,<br><br> please <a href=""http://localhost/reportserver""> click here</a> to login into <br><br>thank you"
     
          extensionParams(6) = New ParameterValue()
          extensionParams(6).Name = "IncludeLink"
          extensionParams(6).Value = "True"
     
          extensionParams(7) = New ParameterValue()
          extensionParams(7).Name = "Priority"
          extensionParams(7).Value = "NORMAL"
     
          Dim parameters(2) As ParameterValue
     
          Dim parameter As New ParameterValue()
          parameter.Name = "EmpID"
          parameter.Value = "288"
          parameters(0) = parameter
     
          parameter.Name = "ReportMonth"
          parameter.Value = "12"
          parameters(1) = parameter
     
          parameter.Name = "ReportYear"
          parameter.Value = "2003"
          parameters(2) = parameter
     
          Dim matchData As String = scheduleXml
          Dim extSettings As New ExtensionSettings()
          extSettings.ParameterValues = extensionParams
          extSettings.Extension = "Report Server Email"
     
          'Try
             rs.CreateSubscription(report, extSettings, desc, eventType, matchData, parameters)
     
          'Catch e As SoapException
             'Console.WriteLine(e.Detail.InnerXml.ToString())
          'End Try
       End Sub 'Main

     

    For more information, please see:

    ReportingService2005: http://msdn.microsoft.com/en-us/library/reportservice2005.reportingservice2005.aspx

    rs Utility: http://msdn.microsoft.com/en-us/library/aa179659(SQL.80).aspx

     

    Please feel free to ask, if you have any more questions.

     

    Thanks,

    Jin Chen


    Jin Chen - MSFT
     
    Friday, July 03, 2009 7:20 AM
    Moderator

All replies

  • Hi ArtemB,

     

    I would suggest using a script file and the rs script utility to create the subscription.

     

    Here is a sample script for your reference:

    Public Sub Main()
          rs.Credentials = System.Net.CredentialCache.DefaultCredentials
     
          Dim report As String = "/AdventureWorks Sample Reports/Employee Sales Summary"
          Dim desc As String = "v-jc@microsoft.com"
          Dim eventType As String = "TimedSubscription"
          Dim scheduleXml As String = "<ScheduleDefinition><StartDateTime>2009-04-24T09:00:00-08:00</StartDateTime><WeeklyRecurrence><WeeksInterval>1</WeeksInterval><DaysOfWeek><Monday>True</Monday></DaysOfWeek></WeeklyRecurrence></ScheduleDefinition>"
     
          Dim extensionParams(7) As ParameterValue
     
          extensionParams(0) = New ParameterValue()
          extensionParams(0).Name = "TO"
          extensionParams(0).Value = "v-jc@microsoft.com"
     
          extensionParams(1) = New ParameterValue()
          extensionParams(1).Name = "ReplyTo"
          extensionParams(1).Value = "v-jc@microsoft.com"
     
          extensionParams(2) = New ParameterValue()
          extensionParams(2).Name = "IncludeReport"
          extensionParams(2).Value = "True"
     
          extensionParams(3) = New ParameterValue()
          extensionParams(3).Name = "RenderFormat"
          extensionParams(3).Value = "MHTML"
     
          extensionParams(4) = New ParameterValue()
          extensionParams(4).Name = "Subject"
          extensionParams(4).Value = "@ReportName was executed at @ExecutionTime"
     
          extensionParams(5) = New ParameterValue()
          extensionParams(5).Name = "Comment"
          'extensionParams(5).Value = "Here is your daily sales report for Michael."
          extensionParams(5).Value = "Dear Custome,<br><br> please <a href=""http://localhost/reportserver""> click here</a> to login into <br><br>thank you"
     
          extensionParams(6) = New ParameterValue()
          extensionParams(6).Name = "IncludeLink"
          extensionParams(6).Value = "True"
     
          extensionParams(7) = New ParameterValue()
          extensionParams(7).Name = "Priority"
          extensionParams(7).Value = "NORMAL"
     
          Dim parameters(2) As ParameterValue
     
          Dim parameter As New ParameterValue()
          parameter.Name = "EmpID"
          parameter.Value = "288"
          parameters(0) = parameter
     
          parameter.Name = "ReportMonth"
          parameter.Value = "12"
          parameters(1) = parameter
     
          parameter.Name = "ReportYear"
          parameter.Value = "2003"
          parameters(2) = parameter
     
          Dim matchData As String = scheduleXml
          Dim extSettings As New ExtensionSettings()
          extSettings.ParameterValues = extensionParams
          extSettings.Extension = "Report Server Email"
     
          'Try
             rs.CreateSubscription(report, extSettings, desc, eventType, matchData, parameters)
     
          'Catch e As SoapException
             'Console.WriteLine(e.Detail.InnerXml.ToString())
          'End Try
       End Sub 'Main

     

    For more information, please see:

    ReportingService2005: http://msdn.microsoft.com/en-us/library/reportservice2005.reportingservice2005.aspx

    rs Utility: http://msdn.microsoft.com/en-us/library/aa179659(SQL.80).aspx

     

    Please feel free to ask, if you have any more questions.

     

    Thanks,

    Jin Chen


    Jin Chen - MSFT
     
    Friday, July 03, 2009 7:20 AM
    Moderator