microsoft.public.sqlserver.notificationsvcs
[Top] [All Lists]

Re: NS API

Subject: Re: NS API
From: Joe Webb
Date: Wed, 10 Aug 2005 09:25:14 -0500
Newsgroups: microsoft.public.sqlserver.notificationsvcs
Hi Wayne - 

The only property that you can really maintain for a subscriber is the
enabled property. BOL has an example of how to do that. 

The following code retrieves the subscriptions for a single subscriber
without having to first retrieve the subscriber. Note, that this does
*not* populate the Subscriber object so a subsequent evaluation of the
Enabled property will be inaccurate (it'll show the default value of
true regardless of the actual state of the subscriber).

private SubscriptionEnumeration GetSubscriptions(string sId)
{
        //Create an NSInstance and NSApplication object
        NSInstance instance = getNSInstance();
        NSApplication app = getNSApplication(instance);

        //create a subscriber object
        Subscriber subscriber = new Subscriber(instance);
        subscriber.SubscriberId = sId;
                        
        //get the SubscriptionClassName
        string subClass = "mySubscriptionName";

        //get the subscriptions
        return subscriber.GetSubscriptions(app, subClass);

}


HTH... Let me know if I've misinterpreted your post.

-- 
Joe Webb
SQL Server MVP


~~~
Get up to speed quickly with SQLNS
http://www.amazon.com/exec/obidos/tg/detail/-/0972688811 

I support PASS, the Professional Association for SQL Server.
(www.sqlpass.org)


On Tue, 9 Aug 2005 09:02:57 -0400, "Wayne" <[email protected]>
wrote:

>I'm trying to updated subscriptions for a single subscriber, so far all is 
>working well. However, I was wondering is there a way to pull back just the 
>sing subscriber? Currently I am doing the following:
>
>new SubscriberEnumeration(nsInstance)[subscriberId];
>
>As I understand from the help the new SubscriberEnumeration(nsInstance) 
>creates a collection that contains all the subscribers in the database. This 
>seems to be a bit inefficient, I'd like to just retrieve the subscriber 
>based on the subscriberId.

<Prev in Thread] Current Thread [Next in Thread>