Long operations on a SharePoint 2007 page

Sometimes you would like to accomplish some task on a Page which takes more time than is set as “timeout” and you are seeing Request timed out in your browser.

This type of error is not so informative for end-user and is not beautiful for a complete solution.

SharePoint default solutions solving this kind of problems with “Operation in Progress” page:


SharePoint API proposes SPLongOperation named class to solve this problem the same way in your custom solutions.

MSDN documentation:

This class provides you two main methods: Begin() and End(); and to properties: LeadingHTML and TrailingHTML, which can be set to show custom text.

Between calling Begin and End methods you can complete long operations. Code example:

// "this" is a Page

using (SPLongOperation longOperation = new SPLongOperation(this))


    longOperation.LeadingHTML = "Your operation is in progress.";

    longOperation.TrailingHTML = "Your operation is currently ..";


    // start long operation



    // do nothing 3 minutes

    Thread.Sleep(60000 * 3);


    // when operation will be finished

    // user will be redirected to this page



1 Comment

Comments have been disabled for this content.