Prev: Microsoft.ReportingServices.ReportProcessing.ReportObjectModel.Fields
Next: On demand subreports Reporting Services and / or multiple Datasets
From: harsh_shukla on 23 Nov 2006 08:33 Error : rsMissingElement400 Required field Field missing from input structure. I have written code to createdatadrivensubscrition.My data set contain only 1 field "Product_name" and no parameters to be passed in report....Code is given below. Imports System Imports System.Web.Services.Protocols Imports testconsole.reportserver Class Sample Public Shared Sub Main() Dim rs As New ReportingService2005() rs.Url = "http://localhost/reportserver/reportservice2005.asmx?wsdl" rs.Credentials = System.Net.CredentialCache.DefaultCredentials Dim report As String = "/appdata" Dim description As String = "My new data driven subscription" ' Set the extension setting as report server email. Dim settings As New ExtensionSettings() settings.Extension = "Report Server Email" ' Set the extension parameter values. Dim extensionParams(7) As ParameterValueOrFieldReference Dim [to] As New ParameterFieldReference() ' Data-driven. [to].ParameterName = "TO" [to].FieldAlias = "EmailAddress" extensionParams(0) = [to] Dim replyTo As New ParameterValue() replyTo.Name = "ReplyTo" replyTo.Value = "harsh.shukla(a)gmail.com" extensionParams(1) = replyTo Dim includeReport As New ParameterValue() includeReport.Name = "IncludeReport" includeReport.Value = "False" extensionParams(2) = includeReport Dim renderFormat As New ParameterValue() renderFormat.Name = "RenderFormat" renderFormat.Value = "HTML4.0" extensionParams(3) = renderFormat Dim priority As New ParameterValue() priority.Name = "Priority" priority.Value = "NORMAL" extensionParams(4) = priority Dim subject As New ParameterValue() subject.Name = "Subject" subject.Value = "Your sales report" extensionParams(5) = subject Dim comment As New ParameterValue() comment.Name = "Comment" comment.Value = "Here is the link to your report." extensionParams(6) = comment Dim includeLink As New ParameterValue() includeLink.Name = "IncludeLink" includeLink.Value = "True" extensionParams(7) = includeLink settings.ParameterValues = extensionParams ' Create the data source for the delivery query. Dim delivery As New DataSource() delivery.Name = "" Dim dataSourceDefinition As New DataSourceDefinition() dataSourceDefinition.ConnectString = "Data Source=SAMHOUSTAN;Initial Catalog=LiveMetrics_Admin" dataSourceDefinition.CredentialRetrieval = CredentialRetrievalEnum. Store dataSourceDefinition.Enabled = True dataSourceDefinition.EnabledSpecified = True dataSourceDefinition.Extension = "SQL" dataSourceDefinition.ImpersonateUserSpecified = False dataSourceDefinition.UserName = "sa" dataSourceDefinition.Password = "sa" delivery.Item = dataSourceDefinition ' Create the fields list. Dim fieldsList(0) As Field fieldsList(0) = New Field() fieldsList(0).Name = "product_name" fieldsList(0).Alias = "product_name" ' Create the data set for the delivery query. Dim dataSetDefinition As New DataSetDefinition() dataSetDefinition.AccentSensitivitySpecified = False dataSetDefinition.CaseSensitivitySpecified = False dataSetDefinition.KanatypeSensitivitySpecified = False dataSetDefinition.WidthSensitivitySpecified = False dataSetDefinition.Fields = fieldsList Dim queryDefinition As New QueryDefinition() queryDefinition.CommandText = "select product_name from lmappdata" queryDefinition.CommandType = "Text" queryDefinition.Timeout = 45 queryDefinition.TimeoutSpecified = True dataSetDefinition.Query = queryDefinition Dim results As New DataSetDefinition() Dim changed As Boolean Dim abc As String() = Nothing Try results = rs.PrepareQuery(delivery, dataSetDefinition, changed, abc) Catch ex As SoapException Console.WriteLine(ex.Detail.InnerText.ToString()) End Try Dim dataRetrieval As New DataRetrievalPlan() dataRetrieval.DataSet = results dataRetrieval.Item = dataSourceDefinition ' Set the event type and match data for the delivery. Dim eventType As String = "TimedSubscription" Dim matchData As String = "<ScheduleDefinition>" & _ "<StartDateTime>2003-04-14T19:15:00-07:00</StartDateTime>" & _ "<WeeklyRecurrence><WeeksInterval>1</WeeksInterval>" & _ "<DaysOfWeek>" & _ "<Monday>True</Monday><Tuesday>True</Tuesday><Wednesday>True</Wednesday><Thursday>True</Thursday><Friday>True</Friday>" & _ "</DaysOfWeek></WeeklyRecurrence>" & _ "</ScheduleDefinition>" 'Dim parameters(0) As ParameterValueOrFieldReference 'Dim product_name As New ParameterFieldReference() ' Data-driven. 'product_name.ParameterName = "product_name" 'product_name.FieldAlias = "product_name" 'parameters(0) = product_name ' Set the report parameter values. Try Dim subscriptionID As String = rs.CreateDataDrivenSubscription( _ report, settings, dataRetrieval, description, eventType, matchData, Nothing) Catch ex As SoapException Console.WriteLine(ex.Detail.InnerText.ToString()) End Try End Sub 'Main End Class 'Sample so plz help me out to solve this error. |