Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


Adding Subscriptions

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,32238
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Adding Subscriptions
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 Adding Subscriptions - 3/13/2006 8:38:22 PM   
  sunnychandra39

 

Posts: 4
Score: 0
Joined: 3/13/2006
Status: offline
Hi everyone,

Im new to VB scripting...Im using MS SQL server 2005 notification services and trying to add subscribers and subscriptions using VBscript.
I have been successful in adding subscribers but am getting an error while trying to add subscriptions... here's my code and the error:

'
' AddSubscriptions.vbs
'
' Add a set of subscriptions to the ********** application
'
AddSubscriptions

Function AddSubscriptions()
Dim nsInstance, nsApplication, nsSubscription
' Create NSInstance object
Set nsInstance =
WScript.CreateObject("Microsoft.SqlServer.NotificationServices.NSInstance")
nsInstance.Initialize "*******"

' Create NSApplication object       
Set nsApplication =
WScript.CreateObject("Microsoft.SqlServer.NotificationServices.NSApplication")
nsApplication.Initialize (nsInstance), "**********"
' Create NSSubscription object
Set nsSubscription =
WScript.CreateObject("Microsoft.SqlServer.NotificationServices.Subscription")
nsSubscription.Initialize (nsApplication), "**********Subscriptions"

' Set common properties for all subscribers 
nsSubscription.SetFieldValue "DeviceName", "myDevice"
nsSubscription.SetFieldValue "SubscriberLocale", "en-us"
' Add subscriptions
nsSubscription.SubscriberId = "******"
nsSubscription.SetFieldValue "City", "*********"
nsSubscription.Add
nsSubscription.SubscriberId = "*****"
nsSubscription.SetFieldValue "City", "*********"
nsSubscription.Add
nsSubscription.SubscriberId = "***********"
nsSubscription.SetFieldValue "City", "*********"
nsSubscription.Add
wscript.echo "Subscriptions successfully added."
End Function

ERROR MESSAGE:
Line:          25
Char:          2
Error:        Specified argument was out of range of valid values.
Parameter name: subscriptionClassName
Code:       80131502
Source:     MicrosoftSqlServer.NotificationServices

any help will be much appreciated!

cheers,
Sunny
 
 
Post #: 1
 
 RE: Adding Subscriptions - 3/13/2006 8:51:44 PM   
  rOOs


Posts: 63
Score: 0
Joined: 2/28/2006
From: Switzerland
Status: offline
Does this one help you?

http://msdn2.microsoft.com/en-us/library/ms167266.aspx


(in reply to sunnychandra39)
 
 
Post #: 2
 
 RE: Adding Subscriptions - 3/13/2006 9:13:34 PM   
  sunnychandra39

 

Posts: 4
Score: 0
Joined: 3/13/2006
Status: offline
unfortunately not...my code is designed on the same lines as the one in MS notification services tutorial... very similar. But that bit of code is throwing up its own errors...

What would: Error: Specified argument was out of range of valid values
Parameter name: subscriptionClassName be? 

(in reply to rOOs)
 
 
Post #: 3
 
 RE: Adding Subscriptions - 3/13/2006 9:18:53 PM   
  rOOs


Posts: 63
Score: 0
Joined: 2/28/2006
From: Switzerland
Status: offline
The Error says something like:
What you give me is wrong.

The Line you mentioned is the:
nsSubscription.SetFieldValue "DeviceName", "myDevice"

if i counted right  ;-)

maybe the DeviceName "myDevice" is in use? Change it and try it again?

I'm not into this SQL and Subscriptions, but i thought maybe i can help you anyway...

(in reply to sunnychandra39)
 
 
Post #: 4
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Adding Subscriptions Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts