Gorgo.Live.ToString()

Mariusz, Gorzoch tech Blog

Forcing daily alerts to send notification immediately

with one comment

Few days ago I was working on the solution with create search alerts based on some custom criteria’s. I’ve build solution quite smoothly till the point when I needed to test it.. Guess what : I’ve deployed solution, created alert and…… nothing happened :(. I dig around my code, did some changes, deploy it again and …. I needed to wait one more day to see if it was working. This make no sense, so I started to dig to find some solution and here it is what I found.

In order to fire “daily” alerts immediately you need to do few things:

  1. Check if alerts are enabled at all on your site

To do it simply use stsadm with parameter :

stsadm -o getproperty -pn alerts-enabled -url {your site collection URL}

is as a result you get that property does exist then you are fine. If not, then simply set-up this property by calling:

stsadm -o setproperty -pn alerts-enabled -url {your site collection URL} –propertyvalue “yes

2. Check job-daily-alerts

stsadm -o getproperty -pn job-daily-alerts -url {your site collection URL}

and set it so those alerts can be filed-up thru entire day

stsadm -o setproperty -propertyname job-daily-alerts –url {your site collection URL} -propertyvalue "daily between 1:00:00 and 23:00:00"

Now your alerts will be processed on every run of “Immediate alerts” job (which by default is scheduled to start every 5 minutes)

3. and now the most dirty part. You need to go into SharePoint database and reset last notify date.

SharePoint daily alerts are send once per day and SharePoint control this by saving information around the scheduled run time inside “SchedSubscriptions” table (here is some reference to that table: http://msdn.microsoft.com/en-us/library/dd956733(v=office.12).aspx). Once alerts are processed SharePoint save next run time. This field is used by “immediate alerts” job to check if he should process daily alerts or not.

In order to force SharePoint to process your daily alert immediate (or in 5 minute window) you need to update value in “NotifyTime” and “NotifyTimeUTC” field to the nearest time when you want the alert to be run:

image

so, in case NotifyTime = “2011-02-27 08:00” then this mans that SharePoint will process your particular daily alert on “2011-02-27 08:00” or just a few second after that (depend when the immediate alert job will be fired)

Setup NotifyTime to the time when you need SharePoint to process you daily alert and NotifyTimeUTC to the UTC corresponding time from NotifyTime field.

4. Perform full crawl of data

Don’t forget about this part. Remember that each querie run against SharePoint engine use only crawled data. So if you just add some new values into lists/document libraries with fallow you search alert criteria then you will not get them as a result of search query till you perform full crawl of content.

done!… if you fallow above then you will be able to test your alerts right after you do some changes around your code.

Advertisements

Written by Mariusz Gorzoch

26 February 2011 at 18:06

Posted in SharePoint

Tagged with ,

One Response

Subscribe to comments with RSS.

  1. I tried to change notifytime and all others step but i don’t receive the email when immediate job run. In the [EventLog] table there are modified data. I ran incremental search not full search, is it the same? Where i wrong?

    Simo

    28 September 2011 at 11:11


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: