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.";
// Operations that have to be performed
That’s all for today!
Didier Danse – http://didierdanse.net
Microsoft Most Valuable Professional SharePoint
Devoteam Luxembourg – Devoteam Group