Microsoft KB Archive/936759

= 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 ID: 936759

Article Last Modified on 5/31/2007

-

APPLIES TO


 * Microsoft Windows SharePoint Services 3.0
 * Microsoft Office SharePoint Server 2007

-



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:// Version3, and the URL of the Windows SharePoint Services 2.0 server is http:// Version2.

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 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 &quot;as is&quot; 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(&quot;Could not access Site Collection: {0}&quot;, ioex.Message); }               catch (Exception ex) {                   Console.WriteLine(&quot;An unexpected error occurred: {0}&quot;, ex.Message); } // try }           else Console.WriteLine(&quot;No Site Collection URL was specified.&quot;); }

//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(&quot;\n{0} Alert(s) for site: {1} ({2})&quot;, spweb.Alerts.Count, spweb.Title, spweb.Url);

foreach (SPAlert alert in spweb.Alerts) {               try {                   Console.WriteLine(&quot; {2} Alert \&quot;{0}\&quot; for user \&quot;{1}\&quot; \n  (Id: {3})\n&quot;, alert.Title, (alert.User != null ? alert.User.Name : &quot; &quot;), 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(&quot; -> Error changing Alert. {0}&quot;, ex.Message); } // inner try }               catch (Exception ex) {                   Console.WriteLine(&quot; An unexpected error occurred while accessing the Alert object: {0}&quot;, 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

Additional query words: server site collection add attach subscribe wss wss3.0 moss moss2007

Keywords: kbtshoot kbexpertiseinter kbprb KB936759

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.