- , Microsoft SharePoint 2007?
SPLongOperation is the class to use. It has 2 important methods.
Beginning and the end;
All your code that has been running for a long time is placed between the beginning and the end.
The following is an example class.
It is almost simple and simple :-)
using System;
using System.Web;
using System.Web.UI.WebControls;
using Microsoft.SharePoint;
namespace CreateLongOperation
{
public class LongRun : System.Web.UI.Page
{
protected Button buttonOk;
protected void Page_Load(object sender, EventArgs e)
{
buttonOk.Click += new EventHandler(buttonOk_Click);
}
void buttonOk_Click(object sender, EventArgs e)
{
SPLongOperation operation = new SPLongOperation(this.Page);
operation.Begin();
System.Threading.Thread.Sleep(6000);
operation.End("http://sps/_layouts/Mynewpage.aspx");
}
}
}
source
share