Sharepoint Forum

Ask Question   UnAnswered
Home » Forum » Sharepoint       RSS Feeds

Subcription thru programmatically

  Asked By: Samir    Date: Aug 22    Category: Sharepoint    Views: 823

I want to force some users to subscribe to one folder (folder name Test)
through programmatically so that they will get notification once in a
week or when somebody modifies that folder.this is the code i got from
msdn.where i will run this code?

Function CreateSubscription( _
bstrWorkspaceName As String, _
bstrSubscribeTo As String, _
lSubscriptionType As Long, _
lNotificationType As Long, _
bstrEmailAddress As String, _
bstrDescription As String, _
lActionMask As Long, _
bstrModifiedBy As String, _
pvarRequestUrl As Variant, _
pvarLocaleId As Variant, _
pvarForWhichUser As Variant, _

) As String
Dim oSubMgr
Set oSubMgr = CreateObject("PKM.SubscriptionManager")

Dim strWorkspace
strWorkspace = "MyWorkspace"
Dim strSubscriptionUrl

'4=search subscription, 1=immediate notification, 32767=subscribe to all
strSubscriptionUrl = oSubMgr.CreateSubscription(strWorkspace, _
"CONTAINS('Microsoft2')", _
4, _
1, _
"test@...", _
"My Search Subscription", _
32767, _



4 Answers Found

Answer #1    Answered By: Erica Lewis     Answered On: Aug 22

I have the same problem that Mohamed, does anyone know how to do it?

Answer #2    Answered By: Marquise Farley     Answered On: Aug 22

this code  works for me :

on error resume next

Const ACTION_ALL = &HFFFF ' Recommended value for all subscription

Set oSubMgr = CreateObject("PKM.SubscriptionManager")
strSubscriptionUrl = oSubMgr.CreateSubscription(strWorkspace, subscriptionurl,
3, 1,email,substitl, ACTION_ALL, "", serveraddress,32767 , user )
Set oResMgr= oSubMgr.GetResultManager(strWorkspace)

if len(strsubscriptionurl)<1 then
wscript.echo "error"
end if
wscript.echo strsubscriptionurl
set oSubMgr=nothing

Answer #3    Answered By: Gargi Mehta     Answered On: Aug 22

how to run  this code.................

Answer #4    Answered By: Radhika Vora     Answered On: Aug 22

this is a vbs code, which can be run  via the cscript utility. But I think you
can run it with VBA also.

Didn't find what you were looking for? Find more on Subcription thru programmatically Or get search suggestion and latest updates.