rs.exe调用:
C:\Program Files (x86)\Microsoft sql Server\130\Tools\Binn>rs.exe -i C:\Users\me\Desktop\RSS_gen\subs.RSS -s "localhost/ReportserverT"
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`
错误消息:
C:\Users\mee\AppData\Local\Temp\11\dhexge0m.1.vb(43) : error BC30455:
Argument n ot specified for parameter ‘Parameters’ of ‘Public Function
CreateSubscription(R eport As String,ExtensionSettings As
Microsoft.sqlServer.ReportingServices2005. ExtensionSettings,
Description As String,EventType As String,MatchData As Stri ng,
Parameters() As
Microsoft.sqlServer.ReportingServices2005.ParameterValue) As String’.
CS7036 There is no argument given that corresponds to the required formal parameter ‘fileName’ of ‘FileInfo.FileInfo(string)’
红色的波浪线告诉你问题所在.如果我输入左括号,它会给我一个工具提示,它符合预期:
好吧,它需要一个字符串,所以我声明一个字符串并将其提供给它所期望的函数:
所以你遇到的问题是因为你没有给CreateSubscription函数提供它期望的参数.
Argument not specified for parameter ‘Parameters’ of ‘Public Function CreateSubscription
要修复它,请提供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()); } }