RS.exe report for subscription with parameters

I am trying to create dynamic report subscriptions through rs.exe. Be that as it may, I can't get the parameters to work. The enddate value is data / time, so I think it can cause it, but I don't know what to do with it. I tried casting but msg error. remains the same.

rs.exe call:

C:\Program Files (x86)\Microsoft SQL Server\130\Tools\Binn>rs.exe -i C:\Users\me\Desktop\rss_gen\subs.rss -s "localhost/ReportserverT" 

subs.rss file:

 Public Sub Main() rs.Credentials = System.Net.CredentialCache.DefaultCredentials Dim desc As String = "Report description" Dim eventType As String = "TimedSubscription" Dim scheduleXml As String = "<ScheduleDefinition><StartDateTime>2017-12-08T15:00:00</StartDateTime><WeeklyRecurrence><WeeksInterval>1</WeeksInterval><DaysOfWeek><Thursday>True</Thursday></DaysOfWeek></WeeklyRecurrence></ScheduleDefinition>" Dim parameters() As ParameterValue ' If you need setup parameters Dim parameter As ParameterValue parameter.Name = "enddate" parameter.Value = "2017-12-30 10:03:01.250" 'this is date/time parameters(0) = parameter Dim matchData As String = scheduleXml Dim returnValue As String Dim reports() As String = { _ "/My Folder/report"} For Each report As String In reports returnValue = rs.CreateSubscription(report, parameters) Console.WriteLine(returnValue) Next End Sub 'Main`enter code here` 

Msg error:

C: \ Users \ mee \ AppData \ Local \ Temp \ 11 \ dhexge0m.1.vb (43): error BC30455: The n ot argument specified for the Parameters parameter Public Function CreateSubscription (R eport As String, ExtensionSettings As Microsoft .SqlServer.ReportingServices2005. ExtensionSettings, Description Like String, EventType As String, MatchData As Stri ng, Parameters () As Microsoft.SqlServer.ReportingServices2005.ParameterValue) As String '.

+7
reporting-services
source share
2 answers

Let me teach you a trick for programming in .Net. It sounds simple, all you have to do is pass on the functions that they expect . Let me give you a simple example.

With this code, I have a similar error:

enter image description here

CS7036 There are no arguments that match the required formal parameter "fileName" in "FileInfo.FileInfo (string)"

The red squiggle line tells you where the problem is. If I dial the opening bracket, it will give me a hint with the expected :

enter image description here

Well, he needs a string, so I declare a string and pass it to the function as she expects:

enter image description here

So, the problem is that you are not giving the CreateSubscription function the parameters that it expects.

Argument not specified for Parameters. Public Function CreateSubscription

To fix this, provide all the required parameters of the ReportingService2005.CreateSubscription Method :

 public static void Main() { ReportingService2005 rs = new ReportingService2005(); rs.Credentials = System.Net.CredentialCache.DefaultCredentials; string report = "/SampleReports/Employee Sales Summary"; string desc = "Send email to anyone@microsoft.com "; string eventType = "TimedSubscription"; string scheduleXml = @"<ScheduleDefinition><StartDateTime>2003-02-24T09:00:00-08:00</StartDateTime><WeeklyRecurrence><WeeksInterval>1</WeeksInterval><DaysOfWeek><Monday>True</Monday></DaysOfWeek></WeeklyRecurrence></ScheduleDefinition>"; ParameterValue[] extensionParams = new ParameterValue[8]; extensionParams[0] = new ParameterValue(); extensionParams[0].Name = "TO"; extensionParams[0].Value = " dank@adventure-works.com "; extensionParams[1] = new ParameterValue(); extensionParams[1].Name = "ReplyTo"; extensionParams[1].Value = " reporting@adventure-works.com "; ParameterValue parameter = new ParameterValue(); parameter.Name = "EmpID"; parameter.Value = "38"; ParameterValue[] parameters = new ParameterValue[1]; parameters[0] = parameter; string matchData = scheduleXml; ExtensionSettings extSettings = new ExtensionSettings(); extSettings.ParameterValues = extensionParams; extSettings.Extension = "Report Server Email"; try { rs.CreateSubscription(report, extSettings, desc, eventType, matchData, parameters); } catch (SoapException e) { Console.WriteLine(e.Detail.InnerXml.ToString()); } } 
+3
source share

As part of the 2005 reporting service for ms SQL, none of the parameters passed to CreateSubscription are required. Please refer to the link and update the function call method. The error is clear, you are missing the last parameters. Take a look at the bottom of the page for an example.

https://technet.microsoft.com/en-us/library/microsoft.wssux.reportingserviceswebservice.rsmanagementservice2005.reportingservice2005.createsubscription(v=sql.90).aspx

+1
source share

All Articles