Quantcast
Channel: didierdanse.net - Development News
Viewing all articles
Browse latest Browse all 15

SharePoint: How to run a long running operation?

$
0
0

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

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 LuxembourgDevoteam Group


Viewing all articles
Browse latest Browse all 15

Latest Images

Trending Articles





Latest Images