Databases Reference
In-Depth Information
strReport = this.cboReport.Text;
}
if(this.cboOwner.Text!= “”)
{
strOwner = this.cboOwner.Text;
}
rs.Credentials = System.Net.CredentialCache.DefaultCredentials;
foreach (localhost_RS.Subscription subscr in rs.ListSubscriptions(strReport,
strOwner))
{
ListViewItem ListItem = new ListViewItem();
ListItem.Text = subscr.Description;
ListItem.SubItems.Add(subscr.Owner.ToString());
ListItem.SubItems.Add(subscr.EventType.ToString());
ListItem.SubItems.Add(subscr.LastExecuted.ToShortDateString());
ListItem.SubItems.Add(subscr.Status.ToString());
this.lstvwSubscriptions.Items.Add(ListItem);
}
this.btnNewSubscription.Enabled = true;
}
You can add a new subscription using the CreateSubscription method. Arguments passed to this
method are as follows:
ExtensionSettings : This argument is required and can be a little tricky. The
ExtensionSettings object contains two properties. The Extension property is a string indi-
cating the type of delivery extension. The ParameterValues property is an object of type
ParameterValueOrFieldReference that contains an array of ParameterValue objects. Each
element is a name/value pair. Depending on the subscription type, a different list of parameter
name/value pairs is passed using this array. These parameters correspond to the items pre-
sented on the Report Delivery Options section of the Snapshot page in Report Manager.
EventType : This argument takes a string to set either TimedSubscription or SnapshotUpdate .
MatchData : This argument accepts multiple types and values depending on the EventType
argument; these include the ScheduleID for a shared schedule or a string containing the XML
element content for the schedule. Shared schedule information may be obtained using the
ListSchedules method to enumerate the server's schedules.
Parameters : This argument is an array of ParameterValue objects. It is used to supply report
parameters as name/value pairs.
Now, let's put it all together in a sample application. Using the same form as the previous example, I've
placed two text boxes, two combo boxes, and a button on the Panel control at the bottom of the form, as
shown in Figure 10-24.
At the top of this form, the New Subscription button was enabled at the end of the Get Subscriptions
button-click event code. In the click event of this button, you set the Visible property of the panel to True
and get a list of shared subscriptions that have been created on the Report Server, adding the Description
for each schedule to the Schedule combo box. For the following code, you'll look at VB and C# language
examples side by side:
Search WWH ::




Custom Search