Deprecated: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /www/collab365_296/public/wp-includes/functions.php on line 7025

Deprecated: str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in /www/collab365_296/public/wp-includes/functions.php on line 2162

Deprecated: Hook imagify_allow_picture_tags_for_webp is deprecated since version 2.2! Use imagify_allow_picture_tags_for_nextgen instead. in /www/collab365_296/public/wp-includes/functions.php on line 5758
SharePoint 2013 Alerts URL is Showing Up Incorrectly - Collab365
Deprecated: strstr(): Passing null to parameter #1 ($haystack) of type string is deprecated in /www/collab365_296/public/wp-includes/functions.php on line 1145

Deprecated: stripos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /www/collab365_296/public/wp-includes/functions.php on line 1152

Deprecated: stripos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /www/collab365_296/public/wp-includes/functions.php on line 1155

Deprecated: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /www/collab365_296/public/wp-includes/functions.php on line 1162

Deprecated: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /www/collab365_296/public/wp-includes/functions.php on line 1165

Deprecated: strstr(): Passing null to parameter #1 ($haystack) of type string is deprecated in /www/collab365_296/public/wp-includes/functions.php on line 1145

Deprecated: stripos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /www/collab365_296/public/wp-includes/functions.php on line 1152

Deprecated: stripos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /www/collab365_296/public/wp-includes/functions.php on line 1155

Deprecated: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /www/collab365_296/public/wp-includes/functions.php on line 1162

Deprecated: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /www/collab365_296/public/wp-includes/functions.php on line 1165

Warning: Undefined array key "url" in /www/collab365_296/public/wp-content/plugins/thrive-visual-editor/thrive-dashboard/inc/smart-site/classes/class-tvd-smart-shortcodes.php on line 85

I was recently doing some troubleshooting for a SharePoint/TFS Environment that changed from HTTP to a secure environment of HTTPS.  That caused several issues for SharePoint, but one of the issues was the fact that all of the existing sites still had the old URL in them for the SharePoint alerts.  Hmmm….How do we fix that?

Well, first, I tried the old STS Command:

stsadm -o updatealert -url http://yournewurl -oldurl http://yournewurl

However, the command would not work.  It appears that this command has been deprecated in SharePoint 2013.  Stsadm should not be used anyways.

The solution I found that worked, I found over here: http://akforsharepoint.blogspot.com/2013/04/sharepoint-alerts-email-showing-wrong.html

The actual script is:

$SPwebApp = Get-SPWebApplication "http://sites.mysharepoint.com"
foreach ($SPsite in $SPwebApp.Sites)
    {
        foreach($SPweb in $SPsite.AllWebs)
        {
           $alerts = $SPweb.Alerts
                        foreach($alert in $alerts)
                        {          
                                    if($alert.AlertFrequency -eq [Microsoft.SharePoint.SPAlertFrequency]::Daily)
                                    {
                                                $alert.AlertFrequency = [Microsoft.SharePoint.SPAlertFrequency]::Immediate
                                                $alert.Update()
                                                $alert.AlertFrequency = [Microsoft.SharePoint.SPAlertFrequency]::Daily
                                                $alert.Update()
                                    }
                                    ElseIf($alert.AlertFrequency -eq [Microsoft.SharePoint.SPAlertFrequency]::Immediate)
                                    {
                                                $alert.AlertFrequency = [Microsoft.SharePoint.SPAlertFrequency]::Daily
                                                $alert.Update()
                                                $alert.AlertFrequency =[Microsoft.SharePoint.SPAlertFrequency]::Immediate
                                                $alert.Update()
                                    }
                                    Else
                                    {
                                                $alert.AlertFrequency = [Microsoft.SharePoint.SPAlertFrequency]::Daily
                                                $alert.Update()
                                                $alert.AlertFrequency =[Microsoft.SharePoint.SPAlertFrequency]::Weekly
                                                $alert.Update()
                                    }
           
                       
                       write-host -f Green $alert.Title
                       "User Name    - " + $alert.User.Name
            "Title        - " + $alert.Title
            "Frequency    - " + $alert.AlertFrequency
            "Delivery Via - " + $alert.DeliveryChannels
            "Change Type  - " + $alert.eventtype
            Write-Host "=================================="
                        }
            }
  
}

This script doesn’t actually change anything, it simply updates the frequency to some other value and sets it back to their original one. This will force alerts to update its stored absolute URLs and fix the issues reported regarding that.

Now, you know the story is not done that simply right???  Well, I immediately got an Access Denied stating that the SharePoint Farm Admin account did not have access to the database.  This can’t be!!!  The Admin had denied the Farm Account access to the Content Databases for security.  Sigh, I granted DB_Owner and SPData_Access Roles.

The Farm Account also did not have access to the Web Application which I granted via Web Application Security Policy.  Finally – Success!!

(Visited 175 times, 1 visits today)

About the author 

Joshua Davis, DesertedRoad

Summit Bundle

Get 200+ hours of Microsoft 365 Training for 27$!

Master Office 365, Power Platform & SharePoint & Teams With 200+ Hours Of Training Videos and 108 Ebooks in the Collab365 Academy. This offer is insane and is only available for a limited period.