Alert Migration and Creation RRS feed

  • Question

  • Hi - I am about to create a console app to iterate through ALL Alerts in a SharePoint instance and save as XML(?).

    The second task is to create a console app which reads this XML file and recreates the Alerts if a match (list) is found (in another site).

    I have started my first app to retrieve alerts - what I'd like to know is if this is the best approach and if anyone can advise on the XML element of my task. I have no idea how to create the second app yet so lets start with the first!

    Thanks in advance for any help you can offer.

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using Microsoft.SharePoint;
    namespace AlertMigration
        class Program
            private static SPSite _site = null;
            private static SPWeb _currentWeb = null;
            private static SPUserCollection _users = null;
            private static string _siteUrl;
            private static void Main(string[] args)
                _siteUrl = "x";
                _site = new SPSite(_siteUrl);
                _currentWeb = _site.OpenWeb();
                _users = _currentWeb.Users;
                        foreach (SPUser user in _users)
                            SPAlertCollection collAlerts = user.Alerts;
                            Console.WriteLine("Alerts for the User : " + user.Name);
                            foreach (SPAlert alrt in collAlerts)
                                Console.WriteLine(alrt.Item.Title + "–>" + alrt.AlertFrequency);
    				// TODO: Start building XML file
                    catch (Exception ex)

    Monday, August 19, 2013 11:23 AM


  • Hi CDG 100,

    As your alert information is used to create new alert on another site, you need to store the information that will be used for the new created alert like: alert.AlertType, alert.List, alert.EventType, alert.AlertFrequency, etc.

    Here is an article about “Programmatically Creating Alerts in SharePoint 2010”:


    you can follow the sample to see what the information you need to create a new alert, and store the information in the xml file.


    Qiao Wei
    TechNet Community Support

    Wednesday, August 21, 2013 6:05 AM