Sunday, July 11, 2010

SharePoint Long Operations

SharePoint Long Operations/Time Out Issues: 

Use SPLongOperation for performing long task in sharepoint.I was working on creating dynamically multiple site collection when I face issue of Time Out.I researched and find out this amazing option where you can use Long operation in the code to avoid time out issues.

Normally we use Timer Job for stopping Time out issues,but in Custom web part for SharePoint this method works fine.

using (SPLongOperation longOperation = new SPLongOperation(this.Page))
 {
    //Custom Messages on the Spinning Wheel Screen
     longOperation.LeadingHTML = "Creating Site Collections...";
     longOperation.TrailingHTML = "Please wait while Site Collections are being Created...";
     //Start the long operation
      longOperation.Begin();
    ///Do you stuff here
 
  longOperation.End(Result Page URl);
 }




No comments:

Post a Comment