Quantcast
Channel: SharePoint 2010 - Development and Programming forum
Viewing all articles
Browse latest Browse all 11508

Retrieve and Set User Alerts

$
0
0

Hi - I would like to programmatically retrieve all user alerts from sharepoint 2007 in a format which would then allow me to set  against another instance of sharepoint (2013). This would require iterating through all webs/lists and storing as csv or xml.

I plan to iterate the SPAlertCollection, get the values, store and then set against another collection.

Does this approach sound possible? Any examples of guidance appreciated.

   static void Main(string[] args)
        {
            _siteUrl = "";
            _collWebsites = _site.AllWebs;
            foreach (SPWeb oWebsite in _collWebsites)
            {
                SPAlertCollection collAlerts = oWebsite.Alerts;
                foreach (SPAlert oAlert in collAlerts)
                {
                    Console.WriteLine("Website Title: {0} || Alert Title: {1} || User: {2}", oWebsite.Title,
                                      oAlert.Title, oAlert.User.LoginName);
                }
            }


Viewing all articles
Browse latest Browse all 11508

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>