Subscriber.GetSubscriptions Method
Gets all of the subscriber's subscriptions for the specified subscription class in the specified Notification Services application.
네임스페이스: Microsoft.SqlServer.NotificationServices
어셈블리: Microsoft.SqlServer.NotificationServices (in microsoft.sqlserver.notificationservices.dll)
구문
‘선언
Public Function GetSubscriptions ( _
nsApplication As NSApplication, _
subscriptionClassName As String _
) As SubscriptionEnumeration
public SubscriptionEnumeration GetSubscriptions (
NSApplication nsApplication,
string subscriptionClassName
)
public:
virtual SubscriptionEnumeration^ GetSubscriptions (
NSApplication^ nsApplication,
String^ subscriptionClassName
) sealed
public final SubscriptionEnumeration GetSubscriptions (
NSApplication nsApplication,
String subscriptionClassName
)
public final function GetSubscriptions (
nsApplication : NSApplication,
subscriptionClassName : String
) : SubscriptionEnumeration
매개 변수
- nsApplication
An NSApplication that represents the Notification Services application containing the specified subscription class.
- subscriptionClassName
A String containing the name of the subscription class for which all subscriptions for this subscriber should be retrieved.
반환 값
A SubscriptionEnumeration that contains all subscriptions for the subscriber for the specified Notification Services application and subscription class. To see all subscription classes for an application, use the Microsoft.SqlServer.Management.Nmo.SubscriptionClass class.
예
The following examples show how to use the GetSubscriptions method to retrieve all subscriptions in one subscription class of one Notification Services application for a subscriber:
Dim instanceName As String = "Tutorial"
Dim applicationName As String = "Weather"
Dim subscriptionClassName As String = "WeatherCity"
Dim subscriptionFieldName As String = "City"
' Create the NSInstance object.
Dim testInstance As NSInstance = New NSInstance(instanceName)
' Create the Subscriber object.
Dim testSubscriber As Subscriber = New Subscriber(testInstance)
' Set the subscriber ID so that the
' correct records are retrieved.
testSubscriber.SubscriberId = "TestUser1"
' Create the NSApplication object.
Dim testApplication As NSApplication = _
New NSApplication(testInstance, applicationName)
' Retrieve the subscriber's subscriptions.
Dim testSubscriptionEnumeration As SubscriptionEnumeration = _
testSubscriber.GetSubscriptions( _
testApplication, subscriptionClassName)
Dim singleSub As Subscription
For Each singleSub In testSubscriptionEnumeration
Console.WriteLine(singleSub(subscriptionFieldName).ToString())
Next
Console.ReadLine()
string instanceName = "Tutorial";
string applicationName = "Weather";
string subscriptionClassName = "WeatherCity";
string subscriptionFieldName = "City";
// Create the NSInstance object.
NSInstance testInstance = new NSInstance(instanceName);
// Create the Subscriber object.
Subscriber testSubscriber = new Subscriber(testInstance);
// Set the subscriber ID so that the
// correct records are retrieved.
testSubscriber.SubscriberId = "TestUser1";
// Create the NSApplication object.
NSApplication testApplication =
new NSApplication(testInstance, applicationName);
// Retrieve the subscriber's subscriptions.
SubscriptionEnumeration testSubscriptionEnumeration =
testSubscriber.GetSubscriptions
(testApplication, subscriptionClassName);
foreach (Subscription singleSub in testSubscriptionEnumeration)
{
Console.WriteLine(singleSub[subscriptionFieldName].ToString());
}
Console.ReadLine();
스레드 보안
Any public static (Shared in Microsoft Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
플랫폼
개발 플랫폼
지원되는 플랫폼 목록은 SQL Server 2005 설치를 위한 하드웨어 및 소프트웨어 요구 사항을 참조하십시오.
대상 플랫폼
지원되는 플랫폼 목록은 SQL Server 2005 설치를 위한 하드웨어 및 소프트웨어 요구 사항을 참조하십시오.
참고 항목
참조
Subscriber Class
Subscriber Members
Microsoft.SqlServer.NotificationServices Namespace