"Alert Me" feature and SharePoint 2013

by Robi 31. October 2013 13:58

 

In the previous few projects we had some issues involving alerts after upgrading or migrating to SharePoint 2013, so I wanted to explain how you can help yourself out when troubleshooting alerts in SP2013.

I described here a few most common issues we were faced with.

1. The "Alert Me" Feature is not available

If you happen to be in the documents library, and you do not find the command "Alert Me", the most likely problem is that you have not set up "Outgoing Email Settings" in Central Administration. Outgoing Email can be found in the category System Settings Configure Outgoing E-Mail Settings or at the URL: http://[CA_URL],/_admin/globalemailconfig.aspx.

Another option to set the Alerts is of course the use of PowerShell. Script with which you can set up alerts is as follows:

 

# == == == == == = Set variables == == == == ==

$SMTPServer = "devmail"

$emailAddress = "SP2013@dev.local"

$replyToEmail = "robi@dev.local"

   

# == == == == == = Outgoing Email = == == == == ==

$loadasm =[System.Reflection.Assembly]::LoadWithPartialName ("Microsoft SharePoint.")

$spGlobalAdmin = New-Object To Microsoft SharePoint. SPGlobalAdmin Administration. ..

$spGlobalAdmin.UpdateMailSettings ($SMTPServer, $emailAddress, $replyToEmail, 65001)

   

The result of our setting is then visible to the Central Administration and on the Ribbon in lists or libraries where the Alert Me button appears:

2. You are not able to create alerts for domain Email enabled security groups or distribution groups

In SharePoint 2013, we came across a very interesting example, where through the user interface you are not able to subscribe a domain security group to alerts. In the document library or list, click the alert me button, the dialog box opens, where you can enter the user you would like to subscribe to alerts. In previous versions of SharePoint names of distribution groups or email enabled security groups get resolved, while in the new version domain groups do not work. You get a "No matching results".

If you want to create alerts for your domain groups, you must use PowerShell:

 

 

<# ================================================

   

Options, setting EventType

   

SPEventType [Add, Modify, Delete, Discussion, All]

   

Setting options in the alert frequency

the case of the daily, weekly, it is necessary to also set

alert hour

   

SPAlertFrequency [Immediate, Daily, And Weekly]

   

================================================ #>

   

$web=Get-SPWeb "http://2013portal"

$list=$web.Lists.TryGetList("Documents")

$user = $web.EnsureUser('DEV\skupinaemail')

$newAlert = $user.Alerts.Add()

$newAlert.Title = $list.Title

$newAlert.AlertType=[Microsoft.SharePoint.SPAlertType]::List

$newAlert.List = $list

$newAlert.DeliveryChannels = [Microsoft.SharePoint.SPAlertDeliveryChannels]::Email

$newAlert.EventType = [Microsoft.SharePoint.SPEventType]::All

$newAlert.AlertFrequency = [Microsoft.SharePoint.SPAlertFrequency]::Daily

$newAlert.AlertTime="12:00"

$newAlert.Update()

 

 

In order to verify whether they have successfully set up alerts, open the Site Settings / User alerts

For the purposes of testing and the display of alerts, I created another alert for the same group, the only difference is that in this case, I use the "Frequency" Immediate Alert.

3. The user has set Alert on item adding in document library, but an immediate alert is not sent

For this example, it is necessary to understanding how alerts work. SharePoint Content databases has a table, which is called the EventCache. This is the table where SharePoint writes events that are important to search service application, alerts, ..., in short, the table serves as a temporary repository of current events, which is then used for subsequent operations. In the case of alerts, all subsequent operations for Immediate alerts are taken care of by the Timer job, which can be found in the Central Administration and is called Immediate Alerts or you can list all Timer jobs by simple PowerShell query:

Get-SPTimerJob | ? {$_.name -like "alert"}

   

As we can see from the results of the command, the Timer Job triggers every 5 minutes. The timer job queries the content databases and table EventCache. In the event that the table contains records for sending alerts, alert email is sent and record gets deleted from the event cache table.

Warning! Running a query directly to the SharePoint database is not supported.

To see what EventCache table contains, you can run this SQL Query against your Content DB:

select * from [SP13_Content_2013Portal].[dbo].[EventCache] (nolock)order by [TimeLastModified] desc

   

So, if I make a change on the document in the document library and perform a query, I get as a result of the following record:

Query result can be also the first verification that alerts work properly. For the purpose of subsequent verifications of Alerts, we have to use ULS Log Viewer and set up Verbose logging in Central Administration for alerts. Alerts logging can be found in the SharePoint Foundation category.

In the ULS Log Viewer, you have the option of filtering ULS logs. The easiest way to get all records related to the alerts, is to set the filter, as shown in the image:

If you want to see the records in the ULS logs and do not want to wait for 5 minutes, you must manually trigger Immediate Alerts Timer Job.

In my case, I'm exploring what's happening with alerts to which user Uroš is subscribed to. In the document library I uploaded a new document and started the Immediate alerts timer job with the use of PowerShell:

Get-SPTimerJob | ? {$_.name -like "*alert*"} |Start-SPTimerJob

   

In ULS logs you can now see records of Alerts operations:

In this case, I see that alerts work as expected. But what happens if we have a library with feature "Require documents to be checked out before they can be edited«?

Repeat the process, upload the document to a document library, in the ULS LOGS watch what's going on with alerts. Following entries appear:

Voila, I can see that the alerts are being processed correctly, however, because loading the document into the document library is a 2 step process, upload and entering metadata, it can be concluded that when uploading a document, document is treated as checked out. Record is written to EventCache table where state of document is registered as Checked out.

With that being said, we can now conclude that when the feature "Require documents to be checked out before they can be edited« on document libraries is enabled and user is subscribed to alerts on document added, alerts are not going to be sent out, as SharePoint treats this documents as checked out, or as the first minor version.

 

In this article I tried to describe some typical errors which may occur in the SharePoint 2013, in conjunction with the Alert Me feature and what's more important, I tried to demonstrate how we can debug and solve errors.

After the troubleshooting, don't forget to set the logging level for the Alerts back to the default settings.

   

Robi Vončina
SharePoint Server MVP

   

Tags:

SharePoint 2013 | SharePoint 2010 | SharePoint - Administration

Add comment

Calendar

<<  September 2018  >>
MonTueWedThuFriSatSun
272829303112
3456789
10111213141516
17181920212223
24252627282930
1234567

View posts in large calendar

Page List

Month List