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.. 🙂