E-mail notifications for alerts are not sent when content in a migrated list or in a migrated document library changes after you perform a database migration to upgrade to Windows SharePoint Services 3.0

Article translations Article translations
Article ID: 936759 - View products that this article applies to.
Expand all | Collapse all

On This Page

SYMPTOMS

Consider the following scenario. You perform a database migration to upgrade Microsoft Windows SharePoint Services 2.0 to Microsoft Windows SharePoint Services 3.0. To do this, you deploy Windows SharePoint Services 3.0. Then, you add the content databases to the Web applications in the new Windows SharePoint Services 3.0 environment.

However, after the migration, Windows SharePoint Services 3.0 does not send e-mail notifications when content changes in a migrated list or in a migrated document library. Users experience the following symptoms:
  • Users do not receive e-mail notifications for existing alerts for a list or for a document library that was migrated from Windows SharePoint Services 2.0.
  • Users do not receive e-mail notifications for new alerts that they create for a list or for a document library that was migrated from Windows SharePoint Services 2.0. To receive e-mail notifications, the user must first delete the existing alert. Then, the user must create a new alert.
Additionally, if you enable verbose tracing, an error message that resembles the following is logged in the Uls log file:
FileNotFound Exception

CAUSE

This issue occurs if the URL of the Windows SharePoint Services 2.0 server differs from the URL of the Windows SharePoint 3.0 server. For example, this issue occurs if the URL of the Windows SharePoint Services 3.0 server is http://ServerNameVersion3, and the URL of the Windows SharePoint Services 2.0 server is http://ServerNameVersion2.

The ImmedSubscription table in the content database has a Siteurl column. If the value in the Siteurl column does not match the URL of the Web application, Windows SharePoint Services does not send e-mail notifications when content in a list or in a document library changes.

WORKAROUND

To work around this issue, use one of the following methods.

Method 1: Use the new "stsadm -o updatealert" command

The new stsadm -o updatealert command was released in the SharePoint Administration Toolkit. For more information and to download the toolkit, visit one of the following Microsoft Web sites, depending on the version of Windows SharePoint Services that you are running.

SharePoint Administration Toolkit x64

http://www.microsoft.com/downloads/details.aspx?FamilyId=F8EEA8F0-FA30-4C10-ABC9-217EEACEC9CE&displaylang=en

SharePoint Administration Toolkit x86

http://www.microsoft.com/downloads/details.aspx?FamilyId=263CD480-F6EB-4FA3-9F2E-2D47618505F2&displaylang=en
For more information, see the "Microsoft SharePoint Administration Toolkit" white paper. To do this, visit the following Microsoft Web site:
http://go.microsoft.com/fwlink/?LinkId=117212&clcid=0x409

Method 2: Use code to update the URLs

Use the following code to update the URLs of alerts in the Siteurl column of the ImmedSubscription table in the content database.

Microsoft provides programming examples for illustration only, without warranty either expressed or implied. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to debug procedures. Microsoft support engineers can help explain the functionality of a particular procedure. However, they will not modify these examples to provide added functionality or construct procedures to meet your specific requirements.
///
///  This source code is freeware and is provided on an "as is" basis without warranties of any kind, 
///  whether express or implied. This includes without limitation warranties that the code is free of defect, 
///  fit for a particular purpose or non-infringing.  The whole risk as to the quality and performance of 
///  the code is with the end-user.
///

using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.SharePoint;
using Microsoft.SharePoint.Administration;

namespace V3UpdateAlerts
{
    class V3UpdateAlerts
    {
        static void Main(string[] args)
        {
            string strSiteCollection = string.Empty;

            // First (and only) argument is the URL to the Site Collection
            if (args.Length > 0)
            {
                strSiteCollection = args[0];

                try
                {
                    using (SPSite spsitecol = new SPSite(strSiteCollection))
                    {
                        using (SPWeb sprootweb = spsitecol.RootWeb)
                        {
                            ListAndFixAlerts(sprootweb);
                        } // using sprootweb
                    } // using spsitecol
                }
                catch (System.IO.FileNotFoundException ioex)
                {
                    Console.WriteLine("Could not access Site Collection: {0}", ioex.Message);
                }
                catch (Exception ex)
                {
                    Console.WriteLine("An unexpected error occurred: {0}", ex.Message);
                } // try
            }
            else
                Console.WriteLine("No Site Collection URL was specified.");
        }

        //Enumerates all Alerts present on a Site Collection and modifies them
        //so that wrong information (for example, in the SiteUrl column) is corrected.
        static void ListAndFixAlerts(SPWeb spweb)
        {
            Console.WriteLine("\n{0} Alert(s) for site: {1} ({2})", spweb.Alerts.Count, spweb.Title, spweb.Url);

            foreach (SPAlert alert in spweb.Alerts)
            {
                try
                {
                    Console.WriteLine(" {2} Alert \"{0}\" for user \"{1}\" \n  (Id: {3})\n", alert.Title, (alert.User != null ? alert.User.Name : "<unknown>"), alert.AlertFrequency.ToString(), alert.ID.ToString());

                    //Preserve the initial Alert frequency (Immed., Daily, Weekly).
                    SPAlertFrequency afPrevious = alert.AlertFrequency;

                    //Change the Alert frequency so the datarow inside
                    //is touched by SharePoint API.
                    if (afPrevious == SPAlertFrequency.Immediate)
                        alert.AlertFrequency = SPAlertFrequency.Weekly;
                    else
                        alert.AlertFrequency = SPAlertFrequency.Immediate;

                    try
                    {
                        alert.Update();

                        //Change the Alert frequency back to the initial state.
                        alert.AlertFrequency = afPrevious;
                        alert.Update();
                    }
                    catch (Exception ex)
                    {
                        Console.WriteLine(" -> Error changing Alert. {0}", ex.Message);
                    } // inner try
                }
                catch (Exception ex)
                {
                    Console.WriteLine(" An unexpected error occurred while accessing the Alert object: {0}", ex.Message);
                } // outer try
            } // foreach alert

            //Handle all Sub-Webs recursively.
            if (spweb.Webs.Count > 0)
            {
                for(int i = spweb.Webs.Count -1; i >= 0; i--)
                {
                    using(SPWeb spsubweb = spweb.Webs[i])
                    {
                        ListAndFixAlerts(spsubweb);
                    } // using spsubweb
                } //for subwebs
            } //if has subweb
        }
    }
}

MORE INFORMATION

For more information about how to upgrade to Windows SharePoint Services 3.0, visit the following Microsoft Web site:
http://technet2.microsoft.com/windowsserver/WSS/en/library/91046a84-57a1-40cb-a32c-ff3395073dc91033.mspx

Properties

Article ID: 936759 - Last Review: May 1, 2008 - Revision: 2.2
APPLIES TO
  • Microsoft Windows SharePoint Services 3.0
Keywords: 
kbtshoot kbexpertiseinter kbprb KB936759

Give Feedback

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com