SharePoint Dragons

Nikander & Margriet on SharePoint

Long operation in progress

Sometimes, there are operations on a SharePoint application page or a web part that take a long time to complete. The best thing to do is to reuse the In Progress animated picture used by SharePoint itself, as shown in the next picture:

This can be accomplished easily by using the SPLongOperation class of the Microsoft.SharePoint namespace. It sets the web page image to the image used by the server to indicate a lengthy operation (typically, an animated image with associated text). The code goes something like this (taken from

using (SPLongOperation objLongOperations = new SPLongOperation(this.Page))
objLongOperations.LeadingHTML =”Processing request”;
objLongOperations.TrailingHTML = “Please wait while the request is being processed…”;
//Write your code here
System.Threading.Thread.Sleep(25000);//added to show the processing screen. Nor required in actual implementation

Check this blog post for more information:

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: