Here's some C# code that can be used to delete all subscriptions for a
particular subscriber. You could put this in a loop of all subscribers
to completely get rid of your subscriptions. (You'll also want to put
this is a try block with proper error handling).
public bool DeleteSubscriptions(string sId)
{
//Create an NSInstance and NSApplication object
NSInstance instance = getNSInstance();
//create a subscriber object
Subscriber subscriber = new Subscriber(instance);
subscriber.SubscriberId = sId;
//delete the subscriptions
subscriber.DeleteSubscriptions() ;
return true;
}
If you have multiple applications for the instance, you can specify in
which application the subscriptions should be deleted.
HTH...
--
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 Fri, 08 Jul 2005 01:00:17 -0500,
[quoted text, click to view] sidgam@hotmail-dot-com.no-spam.invalid (sidgam) wrote:
>Hey Shyam,
>
>Thanks for the response. I do have 2 delivery channels and whenever I
>do my tests I set them up to send emails via both delivery channels.
>I will do some tests using just 1 delivery channel to confirm that
>the Initialize/Close methods are only called once for the batch.
>
>I would like to present the scenario I am trying to use SQL-NS for. I
>want to set SQL-NS up to be able to send push emails ad-hoc. The
>recipient community that will receive these push emails is defined
>via rules. The method I have come up with is to create subscriptions
>to a rule, provide delivery content (body of email) to that rule,
>schedule it for later or immediate delivery. What I want to be able
>to do is to delete the subscriptions when the delivery of the
>notifications is complete. Since the rules are not reused, I would
>like to clean up the subscriptions once delivery is complete to
>prevent my subscriptions table from getting too large.
>
>What is the best way to truncate the subscriptions table? Via code or
>through a scheduled task in the db. I dont see a clean way to call
>the clean up code in the Custom Formatter or Protocol. If via a db
>scheduled task, do I just need to call SP
>NSMain.Dbo.NSDeleteAllSubscriptions?
>
>Please let me know.
Forgot to include the getNSInstance proc in the prior. Nothing
special, just wanted to be complete.
private NSInstance getNSInstance()
{
//Create an NSInstance object
string instanceName =
ConfigurationSettings.AppSettings["NSInstanceName"];
NSInstance instance;
instance = new NSInstance(instanceName);
return instance;
}
HTH...
Joe
--
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, 12 Jul 2005 07:46:11 -0500, Joe Webb
[quoted text, click to view] <joew@webbtechsolutions.com> wrote:
>
>Here's some C# code that can be used to delete all subscriptions for a
>particular subscriber. You could put this in a loop of all subscribers
>to completely get rid of your subscriptions. (You'll also want to put
>this is a try block with proper error handling).
>
>public bool DeleteSubscriptions(string sId)
>{
> //Create an NSInstance and NSApplication object
> NSInstance instance = getNSInstance();
>
> //create a subscriber object
> Subscriber subscriber = new Subscriber(instance);
> subscriber.SubscriberId = sId;
>
> //delete the subscriptions
> subscriber.DeleteSubscriptions() ;
>
> return true;
>
>}
>
>If you have multiple applications for the instance, you can specify in
>which application the subscriptions should be deleted.
>
>HTH...
Thnx for your reponse Joe
The reason for asking if there is a way to delete subscription
directly through the sps is bec. of my unique scenario
The goal here is to use SQL-NS for ad-hoc, one time push emails.
can use the SQL-NS api to create the subscriptions. Once the email
are sent out, the subscriptions would not be used again and it woul
be prudent to clean them out. I would like to run a scheduled tas
to do this
I could write a windows service which leverages SQL-NS api, but i
this can be done through a db scheduled task, I would prefer tha
route
Don't see what you're looking for? Try a search.