Sometimes, we need to run long operations using a synchronous mode. As SharePoint is based on a web technology, performing a long operation can be complex without having timeouts and so on. In SharePoint, we have the possibility to declare an operation as a long running operation.
During the operation (or a set of operations), page is displayed with the classic loading logo with your own message (in the following screenshot, values are default ones) :
Image may be NSFW.
Clik here to view.
This can be done using this simple code:
using (SPLongOperation operation = new SPLongOperation(this.Page))
{
operation.LeadingHTML = "Performing operations ...";
operation.TrailingHTML = "Please wait while the operations are performed.<br/><br/> This can last a few minutes.";
operation.Begin();
// Operations that have to be performed
operation.End(http://yourserver/destinationpage.aspx);
}
That’s all for today!
____
Didier Danse – http://didierdanse.net
Microsoft Most Valuable Professional SharePoint
Devoteam Luxembourg– Devoteam Group
Clik here to view.
