Some time when writing a custom solution in SharePoint which takes some time to process, it is nice to show end user some message screen saying something like “Please wait we are dealing with your request”.

In SharePoint 2010 this functionality is available out of the box, we can call SPLongOperation class in code and display the below screen with custom message and also can redirect to a different page after completion.

// Initialise SPLongOperation object and specify message you want end users to see.
SPLongOperation lp = new SPLongOperation(this.Page);
lp.LeadingHTML = "<div><h2>Processing Request</h2></div>";
lp.TrailingHTML = "<div><h3>Please wait, your request is being processed</h3></div>";
// long running code start 
// long running code end
lp.End(Customers.DefaultViewUrl, Microsoft.SharePoint.Utilities.SPRedirectFlags.Default, this.Context, "");

I hope this will help.

About Us

Follow Us

Email: contact@keapoint.com
Phone:  0208 7852 888

Registered Address: 1 Amber Close, Reading, RG6 7ED. United Kingdom

Company No. 11586817