ReportingService2005.ListSubscriptions(String, String) 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
返回用户针对给定报表创建的订阅的列表。 该列表包含标准订阅和数据驱动的订阅。
public:
cli::array <ReportService2005::Subscription ^> ^ ListSubscriptions(System::String ^ Report, System::String ^ Owner);
public ReportService2005.Subscription[] ListSubscriptions (string Report, string Owner);
member this.ListSubscriptions : string * string -> ReportService2005.Subscription[]
Public Function ListSubscriptions (Report As String, Owner As String) As Subscription()
参数
- Report
- String
报表的完整路径名。
- Owner
- String
要检索其订阅的用户名。
返回
Subscription 对象的数组,这些对象表示用户针对给定报表的订阅。
示例
若要编译以下代码示例,必须引用 Reporting Services WSDL 并导入某些命名空间。 有关详细信息,请参阅 编译和运行代码示例。 以下示例代码使用 ListSubscriptions 方法检索用户 myDomain\myUserName 拥有的“员工销售摘要”报表的订阅列表:
Imports System
Imports System.Web.Services.Protocols
Class Sample
Public Shared Sub Main()
Dim rs As New ReportingService2005()
rs.Credentials = System.Net.CredentialCache.DefaultCredentials
Dim extSettings As ExtensionSettings
Dim desc As String
Dim active As ActiveState
Dim status As String
Dim eventType As String
Dim matchData As String
Dim values As ParameterValue() = Nothing
Dim subscriptions As Subscription() = Nothing
Dim extensionParams As ParameterValueOrFieldReference() = Nothing
Try
subscriptions = rs.ListSubscriptions("/SampleReports/Employee Sales Summary", "myDomain\myUserName")
If Not (subscriptions Is Nothing) Then
' Retrieve properties for the first subscription in the list.
rs.GetSubscriptionProperties(subscriptions(0).SubscriptionID, extSettings, desc, active, status, eventType, matchData, values)
Console.WriteLine("Description: {0}", desc)
Console.WriteLine("Status: {0}", status)
Console.WriteLine("EventType: {0}", eventType)
Console.WriteLine("matchData: {0}", matchData)
Console.WriteLine("Extension: {0}", extSettings.Extension)
extensionParams = extSettings.ParameterValues
If Not (extensionParams Is Nothing) Then
Dim extensionParam As ParameterValueOrFieldReference
For Each extensionParam In extensionParams
Console.WriteLine((CType(extensionParam, ParameterValue).Name + ": " + CType(extensionParam, ParameterValue).Value))
Next extensionParam
End If
If Not (values Is Nothing) Then
Dim pv As ParameterValue
For Each pv In values
Console.WriteLine("Name: {0}", pv.Name)
Console.WriteLine("Value: {0}", pv.Value)
Next pv
End If
End If
Catch e As SoapException
Console.WriteLine(e.Detail.OuterXml)
End Try
End Sub 'Main
End Class 'Sample
using System;
using System.Web.Services.Protocols;
class Sample
{
public static void Main()
{
ReportingService2005 rs = new ReportingService2005();
rs.Credentials = System.Net.CredentialCache.DefaultCredentials;
ExtensionSettings extSettings;
string desc;
ActiveState active;
string status;
string eventType;
string matchData;
ParameterValue[] values = null;
Subscription[] subscriptions = null;
ParameterValueOrFieldReference[] extensionParams = null;
try
{
subscriptions = rs.ListSubscriptions("/SampleReports/Employee Sales Summary",
@"myDomain\myUserName");
if ( subscriptions != null )
{
// Retrieve properties for the first subscription in the list.
rs.GetSubscriptionProperties(subscriptions[0].SubscriptionID, out extSettings, out desc, out active, out status, out eventType, out matchData, out values);
Console.WriteLine("Description: {0}", desc);
Console.WriteLine("Status: {0}", status);
Console.WriteLine("EventType: {0}", eventType);
Console.WriteLine("matchData: {0}", matchData);
Console.WriteLine("Extension: {0}", extSettings.Extension);
extensionParams = extSettings.ParameterValues;
if (extensionParams != null)
{
foreach (ParameterValueOrFieldReference extensionParam in extensionParams)
{
Console.WriteLine(((ParameterValue)extensionParam).Name + ": " + ((ParameterValue)extensionParam).Value);
}
}
if (values != null)
{
foreach (ParameterValue pv in values)
{
Console.WriteLine("Name: {0}", pv.Name);
Console.WriteLine("Value: {0}", pv.Value);
}
}
}
}
catch (SoapException e)
{
Console.WriteLine(e.Detail.OuterXml);
}
}
}
注解
下表显示了有关此操作的标头和权限信息。
SOAP 标头 | (Out) ServerInfoHeaderValue |
所需的权限 | 报表上的 (ReadSubscription ,并且用户是订阅所有者) 或 ReadAnySubscription |
可以在 Visual Basic 中为 和 Report
参数提供 Nothing
null
) (Owner
。 方法返回的信息 ListSubscriptions 因提交的参数而异:
如果 和
Report
null
的Owner
值为 ,则该方法返回当前用户有权查看的所有报表的所有订阅。如果仅
Owner
提交 参数,则该方法将返回指定用户已创建并有权查看的所有报表的所有订阅。如果仅
Report
提交 参数,该方法将返回当前用户有权查看的指定报表的所有用户的所有订阅。如果同时为
Owner
参数和Report
参数提供了有效值,则 该方法将返回指定用户创建并有权查看的指定报表的所有订阅。