Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>You can dynamically generate a one time subscription in SSRS for the report. You'll have to use the RS webservice as mentioned by Diego.</p> <p>Your code would look something like this:</p> <pre><code>static void generateSubscription() { if (SubscriptionRequests.Count &lt; 1) return; NetworkCredential credentials = new NetworkCredential("user", "pass"); reports.ReportingService2005 rs = new reports.ReportingService2005(); rs.Credentials = credentials; DateTime topDatetime = DateTime.Now; topDatetime = topDatetime.AddMinutes(2); foreach (SubscriptionRequest x in SubscriptionRequests) { reports.ExtensionSettings extensionSettings = new reports.ExtensionSettings(); List&lt;reports.ParameterValue&gt; extParameters = new List&lt;reports.ParameterValue&gt;(); List&lt;reports.ParameterValue&gt; parameters = new List&lt;reports.ParameterValue&gt;(); string description = "Email: "; string eventType = "TimedSubscription"; extensionSettings.Extension = "Report Server Email"; string scheduleXml = "&lt;ScheduleDefinition&gt;&lt;StartDateTime&gt;"; scheduleXml += topDatetime.ToShortDateString() + " " + topDatetime.ToShortTimeString(); scheduleXml += "&lt;/StartDateTime&gt;&lt;/ScheduleDefinition&gt;"; parameters.Add(new reports.ParameterValue() { Name = "abc", Value = x.id }); extParameters.Add(new reports.ParameterValue() { Name = "RenderFormat", Value = x.renderFormat }); extParameters.Add(new reports.ParameterValue() { Name = "TO", Value = x.email }); extParameters.Add(new reports.ParameterValue() { Name = "ReplyTo", Value = x.replyTo }); extParameters.Add(new reports.ParameterValue() { Name = "IncludeReport", Value = "True" }); extParameters.Add(new reports.ParameterValue() { Name = "Subject", Value = "subject - " + " (" + x.id.ToString() + ")" }); extParameters.Add(new reports.ParameterValue() { Name = "Comment", Value = x.body }); extensionSettings.ParameterValues = extParameters.ToArray(); description += topDatetime.ToShortDateString() + " " + topDatetime.ToShortTimeString(); description += " (" + x.a + " - " + x.b + " - " + x.c + ")"; string _reportName = "/report"; rs.CreateSubscription(_reportName, extensionSettings, description, eventType, scheduleXml, parameters.ToArray()); topDatetime = topDatetime.AddSeconds(30); } } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload