SSRS Suscriptions, BatchHead parameter
Hi. I'm trying to create a suscription using the web service, the method is not throwing any exception but is not creating the suscription either. Searching for information i saw on the most of the forums and help files that the CreateSuscription method is not asking for a batch header, but mine is asking for it, so i'm thinking that may be something with my instalation. Here is my code to see if any can help me with it. Dim rs As New reportingReference.ReportingService2005SoapClient rs.ClientCredentials.Windows.ClientCredential = System.Net.CredentialCache.DefaultCredentials 'rs.ClientCredentials.Windows.AllowedImpersonationLevel = System.Security.Principal.TokenImpersonationLevel.Impersonation rs.ClientCredentials.Windows.AllowedImpersonationLevel = New System.Security.Principal.TokenImpersonationLevel() Dim batchID As String = String.Empty Dim infoHeader As ServerInfoHeader = rs.CreateBatch(batchID) Dim bh As BatchHeader = New BatchHeader() bh.BatchID = batchID bh.AnyAttr = infoHeader.AnyAttr Dim report As String = "/reportParam1" Dim desc As String = "Send email from code to" Dim eventType As String = "TimedSubscription" Dim scheduleXml As String = "<ScheduleDefinition><StartDateTime>2012-03-22T09:30:00</StartDateTime><WeeklyRecurrence><WeeksInterval>1</WeeksInterval><DaysOfWeek><Thursday>True</Thursday></DaysOfWeek></WeeklyRecurrence></ScheduleDefinition>" '"<ScheduleDefinition><StartDateTime>2012-10-06T08:00:00-08:00</StartDateTime><WeeklyRecurrence>" & _ '"<WeeksInterval>1</WeeksInterval><DaysOfWeek><Monday>True</Monday></DaysOfWeek></WeeklyRecurrence></ScheduleDefinition>" ' "<ScheduleDefinition xmlns:xsd=\""\"" xmlns:xsi=\""\""><StartDateTime xmlns=\""\"">2010-03-06T15:15:00.000+05:00</StartDateTime></ScheduleDefinition>" Dim extensionParams(7) As ParameterValue extensionParams(0) = New ParameterValue() extensionParams(0).Name = "TO" extensionParams(0).Value = "" extensionParams(1) = New ParameterValue() extensionParams(1).Name = "IncludeReport" extensionParams(1).Value = "True" extensionParams(2) = New ParameterValue() extensionParams(2).Name = "RenderFormat" extensionParams(2).Value = "MHTML" extensionParams(3) = New ParameterValue() extensionParams(3).Name = "Subject" extensionParams(3).Value = "@ReportName was executed at @ExecutionTime" extensionParams(4) = New ParameterValue() extensionParams(4).Name = "Comment" extensionParams(4).Value = "Here is your test report for testing purpose" 'extensionParams(5) = New ParameterValue() 'extensionParams(5).Name = "IncludeLink" 'extensionParams(5).Value = "True" extensionParams(5) = New ParameterValue() extensionParams(5).Name = "Priority" extensionParams(5).Value = "NORMAL" Dim parameters(0) As ParameterValue parameters(0) = New ParameterValue() parameters(0).Name = "ReportParameter1" parameters(0).Value = "ReportParameter1" 'parameters(1) = New ParameterValue() 'parameters(1).Name = "UserName" 'parameters(1).Value = "admin" 'parameters(2) = New ParameterValue() 'parameters(2).Name = "SupplierId" 'parameters(2).Value = "0" Dim matchData As String = scheduleXml Dim extSettings As New ExtensionSettings() extSettings.ParameterValues = extensionParams extSettings.Extension = "Report Server Email" Try Dim _sub As String = "" Dim SubID As ServerInfoHeader = rs.CreateSubscription(bh, report, extSettings, desc, eventType, matchData, parameters, _sub) rs.FireEvent(bh, "TimedSubscription", _sub) Catch ex As Exception Console.WriteLine(ex) End Try Thanks
October 10th, 2012 1:36pm

found a work arround. Instead using 2005 WS i changed it to 2010 as says on this post Automatically set up user's subscription in SSRS And it worked. Here is the code. Private Sub Suscription2010() Dim service As New ServiceReference1.ReportingService2010SoapClient() service.ClientCredentials.Windows.ClientCredential = System.Net.CredentialCache.DefaultNetworkCredentials service.ClientCredentials.Windows.AllowedImpersonationLevel = System.Security.Principal.TokenImpersonationLevel.Impersonation Dim userHeader As New ServiceReference1.TrustedUserHeader() Dim desc As String = "Send to Document Library" Dim eventType As String = "TimedSubscription" Dim scheduleXml As String = "<ScheduleDefinition>" + _ " <StartDateTime>2010-11-30T08:00:00-08:00" + _ " </StartDateTime>" + _ " <WeeklyRecurrence>" + _ " <WeeksInterval>1</WeeksInterval>" + _ " <DaysOfWeek>" + _ " <Monday>True</Monday>" + _ " </DaysOfWeek>" + _ " </WeeklyRecurrence>" + _ "</ScheduleDefinition>" Dim extensionParams(4) As ServiceReference1.ParameterValue extensionParams(0) = New ServiceReference1.ParameterValue() extensionParams(0).Name = "TO" extensionParams(0).Value = "my alias" extensionParams(1) = New ServiceReference1.ParameterValue() extensionParams(1).Name = "IncludeReport" extensionParams(1).Value = "FALSE" extensionParams(2) = New ServiceReference1.ParameterValue() extensionParams(2).Name = "IncludeLink" extensionParams(2).Value = "TRUE" extensionParams(3) = New ServiceReference1.ParameterValue() extensionParams(3).Name = "Subject" extensionParams(3).Value = "@ReportName was executed at @ExecutionTime" Dim matchData As String = scheduleXml Dim extSettings As New ServiceReference1.ExtensionSettings extSettings.ParameterValues = extensionParams extSettings.Extension = "Report Server Email" Dim id As String service.CreateSubscription(userHeader, "/reportname", extSettings, desc, eventType, matchData, Nothing, id) End Sub
Free Windows Admin Tool Kit Click here and download it now
October 10th, 2012 4:24pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics