Just little about C#, .NET, SQL Server, SharePoint and SAP

SharePoint Alerts Export Import add-in Part – 1

Posted by zieglers on June 5, 2009

This article explains how you can develop a SharePoint Alerts Export/Import add-in for Central Administration site.

First part of the article ‘Alerst Export/Import add-in for SharePoint Part-1‘, will state the problem leading to this solution. Also, some design points will be mentioned.

Background: One of my clients had to delete subsites when a new version of a site template was developed and recreate the site using the new template. In this case, since the alerts are user/web centric when the site was deleted, they were gone. So, I needed a solution to export alerts before deletion and save them on file system. This was the first part of the scenario. Once the new site is created using the new template, it was time to import them back.

Export operation would be at web application scope. On the other hand import operation would give the flexibility of choosing subsites. Also, import file would need to be chosen among multiple exported files at different times. This would also require an upload functionality while importing. As with all upload operations, validation and extension checks were important.

Another requirement was scalability of the solution. It was expected to work for 100 000 alerts and 1000 different users. This was an optimization problem and every extra loop in the logic would cost extra.. Idea seemed simple: first export them, then selectively import. But as I went further in the implementation, I faced some challenges, unexpected object model behaviours … etc. Here i’ll try to mention everything in detail.


Solution will include two simple custom built application pages for SharePoint Central Administration Site. 

These pages will be reachable thru links in a sub-section called ‘Alerts’ in Application Management section.


First application page, Export Alerts, is for exporting alerts of a selected web application. (Note that, scope here is ‘Web Application’. This means that all site collections and webs will be looped and alerts will be exported in a way that we keep hierarchy for later to be able to import selectively, namely by selecting a site collection and any web sites in it.)


Second application page, Import Alerts into a Site Collection, will have three input sections. Firstly user will select a site collection. Secondly sites, alerts will be imported into, will be selected. Then, exported alerts file will be uploaded using an upload control.

At this point, necessary validations will be performed such as file extension check, file format check, file size check … etc. Once all validations are passed successfully, alerts will be imported to selected web sites.

Since import operation can be time consuming based on the number of alets being imported, SPLongOperation will be used to display on-going progress. Moreover, all errors and import operations will be logged for further investigation in case needed.

Also, for better exception handling error messages will be refactored.


Implementation details are explained in Part-2 of  ‘SharePoint Alerts Export Import add-in’ article.

Stay tuned.. 🙂


7 Responses to “SharePoint Alerts Export Import add-in Part – 1”

  1. grbeatty said

    Great information! My company is facing the split of a large site collection into multiple smaller ones and this will be perfect since we loose alerts with the export/import that has to be used. But, do you have the code/information on how to import the alerts back in? The export is working great for us but I don’t see the second half. Additionally I haven’t been successful at adding the sub section as a menu in the Application Mgmt tab. Do you have those instructions as well? Thanks!

  2. zieglers said

    Thanks for your feedback. Seems like i forgot to write 2nd part for this post. I’ll try to write it in the following days. Since I developed this add-on myself, I have the code and all other related details.

    How many general alerts and search alerts do you have approx. in total?
    I also stress-tested this add-on for 100K alerts and 1000 users. Import operation for 100K alerts takes less than 30min.


  3. grbeatty said

    Thanks very much! Development isn’t my strong point. We currently have about 600 sites sitting in one single site collection. The number of alerts varries widely by site. One of the largest we have found has roughly 200 alerts on just one subsite; they setup one for every user. I know there are a number of other sites that have done similar things.

  4. zieglers said

    Here is the 3rd part of this article – Alerts Import into Webs.



    • grbeatty said

      Thanks for the puting that up. I have to be honest that I’m having a hard time getting my code right though. I almost hate to ask but can you just stick up a link to download the code like you did for the first one? I did manage to get this added to my application mgmt tab though so that was a triumph for me. Regardless, thanks again!

  5. bertrik said

    I’ve tried to implement your great solution for exporting and importing alerts since I need this solution for exporting and importing alerts together with stsadm export and import for site collections.

    Like Grbeatty said at november 17th: I’d manage to create the export xml with all the alerts using your AlertsSave.aspx example.
    But I was not able to create the import due your blogpost.

    Could you give a link to a AlertsImport.aspx like you did for the AlertsSave? I’m missing this link in your 3rd part of your blog about this solution.

    Thanks in advance

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: