Zieglers

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

Posts Tagged ‘Import’

SAP IDES Installation – Import ABAP Phase taking too long issue

Posted by zieglers on February 19, 2011

So far I lost the count on how many SAP IDES installations I made on different environments. Every installation is a new challenge and comes with own unique problems if there exists any.

Recently I tried SAP IDES ECC 6.0 Installation on Hyper-V environment with a host of 8GB Ram. This time I allocated 6GB Ram to WinServer 2003 R2 Standard Edition client, and took some screenshots to share with you all. I read lots of people out there especially complaining about import ABAP taking too long. Of course there are several factors to that like number of parallel import jobs running or memory allocated for client machine and SQL Server … etc.

Here I’m not going to make any conclusions on that. Simply I want to show you my experience of SAP IDES ECC 6.0 Installation on Hyper-V. Yes, import ABAP phase is going to take a long time, and yes it’ll take a lot longer than you expect. Since this is the case, just be patient and let it run smoothly. During this phase, make sure that your client is not going to run out of disk space. Also, set your power options to ‘always on’ so that your host doesn’t go into sleep mode during installation.

Here is the first minutes of Import ABAP Phase.. Note SQL Server memory consumption. 2.7 GB, not too bad for a 6GB client.

As you can see, below screen clearly shows that my IMPORT ABAP Phase almost took 1 day to complete.

(Yes, I was doing SAP Installation on Valentine’s Day :) Well, technically I was only monitoring it, so no harm done to family life..)

Also, another thing to check is that, make sure all 105 import jobs completed successfully as seen below. You can check this from installer log screen.

Following Import ABAP Phase, sometimes first time start of central instance can take some time, but nothing more than 10-20 minutes. There is a time-out limit for that. Once the central instance is up and running, you’ll see disp+work processes like this.

And finally once the installation is complete, here is what you get.

Now you can go ahead and if you haven’t done already, install your SAP GUI and connect to your SAP System for the first time.You can use your DDIC user and password you provided during installation to log on.

Enjoy.

P.S. Note that your temp license will expire in 1 month.

zieglers

Posted in IT Stuff, SAP | Tagged: , , , , , , , , , , , , , , , , , , , | 3 Comments »

SharePoint Alerts Export Import add-in Part – 3

Posted by zieglers on November 9, 2009

Alerts

Here is the 3rd part of the article – SharePoint Alerts Export Import add-in. I realized that it’s been a while that i wrote first and second articles. Taking a quick look at those, i see that “importing alerts” logic is left for this article.

Importing alerts can be done for a selected site collection and also individual subsites can also be selected explicitly. Alerts export logic was exporting all alerts of a site collection, not only root site, but also all subsites. Also those alert details were stored in an xml file in a structured manner. However, for import operation we need a selective import logic. Not all the time we might need to import alerts for a whole site collection. That’s why logic will be a little more complicated than exporting alerts.  

Moreover, an import operation can take some time based on number of alerts being imported and number of subsites exist. That’s why we need to have an SP Long operation so that user knows operation is being executed. Here there is a nice thing to note, that is, if user somehow closes the browser, import operation is not interrupted and goes on in the background until finished.Another important thing is the difference between type of alerts:  sp list alerts and search alerts. Although both of them are using SPAlert class, based on attributes being set a generic list alert can become a search alert. (p_query is the most important attribute for a search alert, basically which holds the query of the search alert)Here is a look how our Alerts Import application page ui is going to be like.   

1

After this intro, it’s time to get started.  Firstly let’s take a look at UI design. 

Alerts Import Page – UI Design

As for site collection selector seen above in first subsection of UI, we’ll use OOTB SharePoint SiteAdministrationSelector control. This control is frequently used in many application pages of Central Admin. Then, in order to list all subsites (in subsection 2) after a site collection is selected, we’ll have a CheckBoxList control. Finally, there is going to be a FileUpload control to select import file – the file which is exported using Alerts Export page. In addition, there is a “Verify” button to validate selected import file.  

SiteAdministrationSelector control 

<!-- *********************************************************
DISPLAY THE SITE COLLECTION SELECTOR USING THE InputFormSecton AND SiteAdministrationSelector CONTROLS. -->
<wssuc:InputFormSection runat="server"
   Title="<%$Resources:spadmin, multipages_sitecollection_title%>"
   Description="<%$Resources:spadmin, multipages_sitecollection_desc%>" >
   <Template_InputFormControls>
      <tr><td>
         <!-- Put your control here-->

<SharePoint:SiteAdministrationSelector id="SiteCollectionSelector" runat="server" OnContextChange="OnContextChange" /></td></tr></Template_InputFormControls> </wssuc:InputFormSection><!-- ********************************************************** -->   

Subsites CheckBoxList 
 
<!-- **********************************************************
DISPLAY ALL SUBSITES USING THE InputFormSecton AND ASP:CheckBoxList CONTROLS -->
<wssuc:InputFormSection runat="server"
   Title="Web Sites"
   Description="Check web sites for which you want to import alerts" >

   <Template_InputFormControls>
   <tr><td>
      <asp:CheckBoxList ID="cbWebs" runat="server" CssClass="ms-listheaderlabel" EnableViewState="true"   />
   </td></tr>        
   </Template_InputFormControls>
</wssuc:InputFormSection>
<!-- *********************************************************** -->

FileUpload control for Alerts Import file and Verify Button
  
<!-- File name section -->
<wssuc:InputFormSection
    Id="SelectFileSection"
    Title="Select Alerts File"
    Description="Browse to the alerts file you intend to import."
    runat="server">
    <Template_InputFormControls>

        <wssuc:InputFormControl runat="server" LabelText="Name :">
         <Template_Control>
         <span dir="ltr"> 
          <asp:FileUpload ID="FileUpload1" runat="server" />
         </span>
         </Template_Control>
        </wssuc:InputFormControl>

        <wssuc:InputFormControl LabelText="Before importing, you can check this alerts import file for detailed errors, warnings, and other information." runat="server">
         <Template_Control>
          <asp:button class="ms-ButtonHeightWidth" runat="server"
           text="Verify"
           OnClick="ButtonVerifyClick"
           id="ButtonVerify">
       </asp:button>
         </Template_Control>
        </wssuc:InputFormControl>

        <wssuc:InputFormControl runat="server">
         <Template_Control>
          <div><asp:Label id="lblFileValidation" runat="server"/></div>
         </Template_Control>
        </wssuc:InputFormControl> 
    </Template_InputFormControls>
</wssuc:InputFormSection>

Alerts Import Page – Import Logic Design

So far, we have our UI elements ready. Now, let's take a look at application logic. Almost all page logic is executed after user clicks ok button. Here is BtnSubmit_Click logic:

Basic validations

  • Check if at least one web selected or not --> Display validation message if no web selected
  • Check uploaded file -->Restrict the user to upload only .xml file

Preparations

  • Assign import log file name and path
  • Get url, port, virtual path details

Import Operation

  • Read Alerts xml file for import operation
  • Initialize date and alert count
  • Iterate through each row of 'Alerts'. This is also equivalent to looping through each web object.
    • Only import alerts for selected webs
    • Get alert property values from xml
    • Check Alert Template Type. This determines if an alert is a Search alert, List Alert, Item Alert ...etc.
    • Create alerts

Alerts Import Page – Implementation

Basic validations

Before starting to import alerts, first we need to check alerts import file. Here we get some info about file using FileUpload control and only allow .xml files.

// Check uploaded file
if (FileUpload1.HasFile)
{
    // get the full path of your computer
    string strFileNameWithPath = FileUpload1.PostedFile.FileName;
    // get the extension name of the file
    string strExtensionName = System.IO.Path.GetExtension(strFileNameWithPath);
    // get the filename of user file
    string strFileName = System.IO.Path.GetFileName(strFileNameWithPath);
    // get the file size
    int intFileSize = FileUpload1.PostedFile.ContentLength / 1024; // convert into byte

    // Restrict the user to upload only .xml file
    strExtensionName = strExtensionName.ToLower();
    if (strExtensionName.Equals(".xml"))
    {
        // upload the file on the server
        FileUpload1.PostedFile.SaveAs(AlertsDir + strFileName);

        strMessages += "Uploaded file details <hr />" +
            "File path on your Computer: " + strFileNameWithPath + "<br />" +
            "File Name: " + strFileName + "<br />" +
            "File Extension Name: " + strExtensionName + "<br />" +
            "File Size: " + intFileSize.ToString();
       
        // Assign Alerts File Path
        alertsFile = AlertsDir + strFileName;
    }
    else
        strMessages += "<br />Only <b>.xml</b> file is allowed, try again!<br />";
}
else
    strMessages += "<br /><b>Select Alerts File: </b>You must select a valid alerts import file.<br />";

Preparations

You can choose an import log file naming convention based on your needs. Here I used DateTime stamp.

// Assign import log file name and path

string logfile = logDir + "ImportLog_" + DateTime.Today.Day.ToString() + DateTime.Today.Month + DateTime.Today.Year.ToString() + ".txt";

Import Operation

  • Read Alerts xml file for import operation

// Read Alerts xml file for import operation
System.Data.DataSet ds = new System.Data.DataSet();

// Read selected alerts import xml file
ds.ReadXml(alertsFile);
ds.Locale = System.Globalization.CultureInfo.CurrentUICulture;

// Read xml document
System.Xml.XmlDocument doc = new System.Xml.XmlDocument();
doc.Load(alertsFile);

// Keep a list of selected webs in an arraylist
ArrayList selectedWebsList = new ArrayList();
foreach (ListItem item in cbWebs.Items)
    if (item.Selected)
        selectedWebsList.Add(item.Text);

  • Initialize date and alert count and check datatable loaded by xml file.

// Initialize date and alert count
long AlertCount = 0;
DateTime start = DateTime.Now;
DateTime finish = DateTime.Now;

// Check if xml file has tables for alerts data
if (ds.Tables.Count < 2)
{
    LogMessageToFile(logDir + "ErrorLog.txt", "Not a valid Alerts xml file");
    strMessages += "<br /><font color=red><b>File Error: </b></font>Not a valid Alerts xml file! <br />";
}

  • Iterate through each row of 'Alerts'. This is also equivalent to looping through each web object.
    • Only import alerts for selected webs
    • Get alert property values from xml
    • Check Alert Template Type. This determines if an alert is a Search alert, List Alert, Item Alert ...etc.
    • Create alerts

In case you are having trouble implementing the solution, here is AlertsImportIntoWebs.aspx page: AlertsImportIntoWebs.aspx

zieglers

Posted in IT Stuff, SharePoint | Tagged: , , , , , | 7 Comments »

SharePoint Alerts Export Import add-in Part – 2

Posted by zieglers on June 5, 2009

In this second part of the article, I’ll mention implementation details of Alerts Export/Import add-in.

Most important decision I took as for implementation was not to use code-behind. Simply I coded everything within .aspx page. Why did I do so? Well, for couple of reasons.

Firstly, this allows faster development by avoiding building VS solution and then deploying the solution. A simple page refresh will force the page recompile. If you are developing just couple of application pages, I’d say don’t waste time by building a solution and deploying it each time code-behind changes. You’ll see coding in .aspx page is much faster. Make sure you know C# syntax well ;)

Secondly, no deployment at all. Since you are directly working on page in 12 hive ADMIN folder, once you save your changes, they are already there and page will be recompiled next time you request the page.

Of course, taking this development approach or not is totally up to you. But if you haven’t tried yet, I’d say give it a try and you’ll see that your C# syntax skills will improve drastically.

Ok, Let’s get started!!!

1. First we need a blank ‘Hello World’ application page.

Since we are developing a blank application page for Central Administration Site, masterpage of our application page must be ‘admin.master‘. Also there are some specific SharePoint controls that will be used, so those must be registered as well.

Now, open up NotePad and create an empty text file and save it as Test.aspx.

a. Adding required assembly and SharePoint control references

Include following snippet to Test.aspx.

<%@ Assembly Name=”Microsoft.SharePoint.ApplicationPages.Administration, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c”%>
<%@ Page Language=”C#” AutoEventWireup=”true” Inherits=”Microsoft.SharePoint.ApplicationPages.GlobalAdminPageBase” MasterPageFile=”~/_admin/admin.master” %>
<%@ Import Namespace=”System.Net” %>
<%@ Import Namespace=”Microsoft.SharePoint” %>
<%@ Import Namespace=”Microsoft.SharePoint.Administration” %>
<%@ Import Namespace=”Microsoft.SharePoint.Utilities” %>
<%@ Import Namespace=”Microsoft.SharePoint.ApplicationPages” %>
<%@ Register Tagprefix=”SharePoint” Namespace=”Microsoft.SharePoint.WebControls” Assembly=”Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c” %>
<%@ Register Tagprefix=”Utilities” Namespace=”Microsoft.SharePoint.Utilities” Assembly=”Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c” %>
<%@ Register TagPrefix=”wssawc” Namespace=”Microsoft.SharePoint.WebControls” Assembly=”Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c”%>
<%@ Register TagPrefix=”wssuc” TagName=”ToolBar” src=”~/_controltemplates/ToolBar.ascx” %>
<%@ Register TagPrefix=”wssuc” TagName=”InputFormSection” src=”~/_controltemplates/InputFormSection.ascx” %>
<%@ Register TagPrefix=”wssuc” TagName=”InputFormControl” src=”~/_controltemplates/InputFormControl.ascx” %>
<%@ Register TagPrefix=”wssuc” TagName=”ButtonSection” src=”~/_controltemplates/ButtonSection.ascx” %> 

b. Adding ContentPlaceHolders

Include PlaceHolderPageTitle and PlaceHolderPageTitleInTitleArea content placeholders. Former determines browser page title, latter determines application page title.

 <asp:Content ID=”PageTitle” runat=”server” ContentPlaceHolderID=”PlaceHolderPageTitle”>
    Test Page Title – AAA
</asp:Content>
<asp:Content ID=”PageTitleInTitleArea” runat=”server” ContentPlaceHolderID=”PlaceHolderPageTitleInTitleArea”>
    Test Page Title – BBB
</asp:Content>

c. Adding Main PlaceHolder

Include PlaceHolderMain content placeholder. This placeholder will hold all controls in the main page area. For our test page we only include an AP.NET Literal control to display HelloWorld message.

<asp:Content ID=”Main” ContentPlaceHolderID=”PlaceHolderMain” runat=”server”>
 <!– Use a ASP.NET Literal Control to display messages –>
 <asp:Literal ID=”litMessages” runat=”server” />
</asp:Content>

d. Adding code for page logic

Now we can start writing code for our test page. Our C# code will be in between script tags of the page. All we need to do is to assign ‘Hello World’ to messages literal control in PageLoad event.

<script runat=”server”>
   
    protected override void OnLoad(EventArgs e)
    {
        //****************************************
        // Validate the page request to avoid
        // any malicious posts
        if (Request.HttpMethod == “POST”)
            SPUtility.ValidateFormDigest();
        //****************************************
        // Validate the page request to avoid
        // any malicious posts
        if (Request.HttpMethod == “POST”)
            SPUtility.ValidateFormDigest();
        //****************************************
        // Initialize the controls on the page
        // if its not a PostBack request
        if (!(Page.IsPostBack))
        {
            litMessages.Text = “Hello World!”;
        } // end – IsPostPack
    }
   
</script>

e. Copy Test.aspx to /12/ADMIN/ folder.

That’s all for our Test application page. No deployment, no building solution.. All we need to do is to copy Test.aspx to ~/12/ADMIN/ folder. Now open your browser. Go to Central Admin site, and test your Test.aspx. (http://yourservername:centraladminportnumber/_admin/Test.aspx)

You can download Test.aspx application page here: TestASPXCode

2. Adding UI controls – SharePoint Web Application Selector

Now we have a blank application page, we can start adding UI elements one by one. It’s always a good practice to keep logically related controls in a panel. Since providing a web application is the only input for export alerts operation, we’ll have only SharePoint Web Application selector control and submit buttons on ExportAlerts page, and will keep those in an input panel as follows.

Add the following snippet in PlaceHolderMain below litMessages literal control.

<!– Use a ASP.NET Panel Control to show or hide the form from code –>
 <asp:Panel ID=”inputForm” runat=”server”>
     <table border=”0″ cellspacing=”0″ cellpadding=”0″ width=”100%”>
        <tr>
          <td>  
         
             <!– *********************************************************
                 DISPLAY THE WEB APPLICATION SELECTOR
                 USING THE InputFormSecton AND WebApplicationSelector CONTROLS.
                 
                 THE TITLE AND DESCRIPTION ARE SPECIFIED IN THE CORRESPONDING
                 ATTRIBUTES OF THE InputFormSection CONTROL, WHILE THE CONTROLS
                 THEMSELVES ARE PLACED INSIDE THE InputFormControl SECTION –>
            <wssuc:InputFormSection runat=”server”
          Title=”Web Application”
          Description=”Select a Web Application” >
                <Template_InputFormControls>
                <tr>
              <td>
                    <SharePoint:WebApplicationSelector id=”Selector” runat=”server”
                      TypeLabelCssClass=”ms-listheaderlabel”
                      AllowAdministrationWebApplication=”true” />
                    </td>
          </tr>
                </Template_InputFormControls>
         </wssuc:InputFormSection>        
            <!– ********************************************************** –>
           
         <!– ****************************
              OK AND CANCEL BUTTON SECTION –>
         <wssuc:ButtonSection runat=”server” TopButtons=”false” BottomSpacing=”5″ ShowSectionLine=”true”>
          <Template_Buttons>
           <asp:Button UseSubmitBehavior=”false” runat=”server” OnClick=”BtnSubmit_Click” Text=”<%$Resources:wss,multipages_okbutton_text%>” id=”BtnSubmitBottom” accesskey=”<%$Resources:wss,okbutton_accesskey%>” Enabled=”true”/>
          </Template_Buttons>
         </wssuc:ButtonSection>
         <!– **************************** –>
        
       </td>
     </tr>
        </table>
    </asp:Panel>

One thing to note here is that we need to provide code for ButtonClick event. So add the following to script section of the page.

    //*************************************************************
    // This method is called when the user clicks the “OK” button
    // to activate the site feature package.
    protected void BtnSubmit_Click(object sender, EventArgs e)
    {
        // Your code here
    }

 So far so good! If you have done everything w/o any mistakes your page should look as follows.

 Alerts-4

3. Adding ‘Export Alerts’ logic.

We have our application page. We have our UI elements (web application selector and submit buttons). Now it’s time to get our hands dirty! All ‘Export Alerts’ logic will be implemented in BtnSubmit_Click event.

 Ok, at this point let’s take a look at our design details once again:

A. Crawl whole web application, which means loop through all site collections and all webs underneath.

foreach –> Site Collection in WebApplication

   foreach –> Web object in Site Collection

      foreach –> alert in Alert Collection of web

               Export alert details to xml file.

B. Xml helper functions. We need helper functions to get alert property details and write them in Alerts Export xml file in a structured way. Those functions are:

CreateXmlDocument, AddChildElement, StringValueOfObject, StringValueOfAlerts

I’m not going to mention details about those helper functions since they are out of our scope. I also didn’t spend time on them to reflect a better coding practice. As a result they are very straight-forward and represent a trivial functional coding. Be my guest if you want to refactor them and make them look better :)

C. Output messages

I haven’t provided logging functionality for export alerts, since exported xml file sort of acts as log itself. Only we need to display some statistics to UI such as number of exported alerts, urls of crawled site collections and webs, execution time, … etc. For this purpose we’ll have only one string variable, namely strMessages. We’ll append any sort of execution messages to this string and then eventually assign it to litMessages.

Here is the BtnSubmit_Click code:

    //*************************************************************
    // This method is called when the user clicks the “OK” button
    // to export alerts of a selected web application.
    protected void BtnSubmit_Click(object sender, EventArgs e)
    {
        //Prepare a string object to display the result
        //of the export alerts operation for each site
        string strMessages = “”;
        // Hide input panel
        inputForm.Visible = false;
       
        try
        {
            // Execution ‘start’ and ‘finish’ time variables
            DateTime start = DateTime.Now;
            DateTime finish = DateTime.Now;
            // Construct Exported Alerts Xml file name
            // Format: ddmmyyyy_hhmmss.xml
            alertsFileName = DateTime.Today.Day.ToString() +
                                    DateTime.Today.Month + DateTime.Today.Year.ToString() +
                                    “_” +
                                    DateTime.Now.Hour.ToString() +
                                    DateTime.Now.Minute.ToString() +
                                    DateTime.Now.Second.ToString() +
                                    “.xml”;
               
            // add all the alert info to an XML document
            System.Xml.XmlDocument Document = CreateXmlDocument();
            //Iterate through each of the site collections
            //in the selected web applications
            foreach (SPSite site in Selector.CurrentItem.Sites)
            {
                //Disable the CatchAccessDeniedException
                //of the site collection to avoid being redirected
                //to the “Access Denied” page if access is denied.
                site.CatchAccessDeniedException = false;
                // Display site url
                strMessages += “<br /><b> === Exporting Alerts for site: ” + site.Url + ” === </b><br />”;
                //Iterate through each site in the site collection
                foreach (SPWeb web in site.AllWebs)
                {
                    // Get all users of the web
                    SPUserCollection collUsers = web.SiteUsers;
                    // Check if there are any alerts to be exported for this web object
                    if (web.Alerts.Count > 0)
                    {
                        // create the alerts root node
                        System.Xml.XmlElement AlertsNode = AddChildElement(Document.DocumentElement, “Alerts”);
                        // Add Web Url attribute
                        System.Xml.XmlAttribute NewAttribute = AlertsNode.OwnerDocument.CreateAttribute(“WebUrl”);
                        AlertsNode.Attributes.Append(NewAttribute);
                        NewAttribute.InnerText = Convert.ToString(web.Url);
                        // Add IsRootWeb attribute
                        NewAttribute = AlertsNode.OwnerDocument.CreateAttribute(“IsRootWeb”);
                        AlertsNode.Attributes.Append(NewAttribute);
                        // Display web object info
                        strMessages += “<br /> + Web : ” + web.Url + ” + <br />”;
                        // Save Alerts to xml
                        // iterate through all the alerts for every user of a site
                        foreach (SPUser oUser in collUsers)
                        {
                            SPAlertCollection collAlerts = oUser.Alerts;
                            if (oUser.Alerts.Count > 0)
                            {
                                // Check if this web is a root web or not
                                if (site.Url == web.Url)
                                    NewAttribute.InnerText = “true”;
                                else
                                    NewAttribute.InnerText = “false”;
                                foreach (SPAlert oAlert in collAlerts)
                                {
                                    // Get alert properties
                                    StringValueOfAlerts(AlertsNode, oAlert);
                                    AlertCount++;
                                } // end – foreach SPAlert
                            } // end -if
                        } // end – foreach SPUser
                       
                    } // end – if AlertsCount
                } // end – foreach SPWeb
                port = site.Port;
                AlertsFile = AlertsDir + port.ToString() + “_” + alertsFileName;
                //Allow the site collection to continue handling
                //access denied exceptions
                site.CatchAccessDeniedException = true;
               
            } // end – foreach SPSite
            // Save Alerts Export file
            Document.Save(AlertsFile);
            strMessages += “<br /> ————————————————————————————– <br />”;
            strMessages += “<br /><b>” + AlertCount.ToString() + “</b> alerts <b><font color=green>successfully</font></b> exported for web application: <b>” + Selector.CurrentName + “</b><br />”;
            strMessages += “<br />Export file: <b>” + port.ToString() + “_” + alertsFileName + “</b><br />”;
            finish = DateTime.Now;
            TimeSpan elapsedTime = finish.Subtract(start);
            strMessages += “<br /> Exported in <b>” + elapsedTime.Minutes.ToString() + “</b> minute(s) and <b>” + elapsedTime.Seconds.ToString() + “</b> seconds and <b>” + elapsedTime.Milliseconds.ToString() + “</b> miliseconds <br />”;
           
        }
        catch (Exception AlertsSaveException)
        {
            //if an error occurs during export alerts operation;
            //capture the message to display it to the user
            //after iterating through all the sites
            strMessages += “<br />Alerts Save Error: ” + AlertsSaveException.Message + “<br />”;
        }
        // Display messages if there are any
        litMessages.Text = strMessages;
       
    }

If you are not interested in details of ‘Export Alerts‘ and just want to use it as soon as possible, you can download “AlertsSave.aspx” from this link: AlertsSaveASPX

(Copy and paste word doc contents in a text file and rename it to AlertsSave.aspx. Then copy it to ~/12/ADMIN/ folder.)

Please let me know if you run into any difficulties while trying to implement/run ‘export alerts’ functionality..

zieglers

Posted in IT Stuff, SharePoint | Tagged: , , , , , , , , | Leave a Comment »

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.

Design:

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.

Alerts-1

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

Alerts-2

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.

Alerts-3

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

Stay tuned.. :)

zieglers

Posted in IT Stuff, SharePoint | Tagged: , , , , , , | 7 Comments »

 
Follow

Get every new post delivered to your Inbox.

Join 49 other followers