SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

After a site is provisioned my code is continue to run. Is there a way to put hour glass or some animated image until i hit the last line of the code?

public override void WebProvisioned(SPWebEventProperties properties)
share|improve this question
Did this work for you? I was trying to accomplish teh same thing in my ItemAdding event receiver but I can't figure out how to use the SPLongOperation method. – user4390 Aug 9 '11 at 14:34
up vote 1 down vote accepted

The default WebProvisioned event receiver is asynchronous and actually runs under the owstimer, not the IIS worker process. Regardless, even if you specify synchronous, there is no ability to interact with the user browser to control the cursor.

share|improve this answer
Thanks for the inside details. – Monica Contera May 18 '11 at 17:17
Thanks @Chris.. Is there an equivilant synchronous method for WebProvisioned that is run in the user context? I'm not able to get in and check right at the moment. – Clayton Firth May 18 '11 at 22:27
You need to add a Synchronization node to the event receiver element... check this blog:… – Chris Beckett May 19 '11 at 17:35

I believe that you can use the SPLongOperation class to achieve this.

You need to put the long running code between SPLogOperation.Begin() and SPLongOperaiton.End() method invocation.

var longOperation=new SPLongOperation(this.Page);
longOperation.LeadingHTML = "Please wait while the operation is running";
longOperation.TrailingHTML = "Once the operation is finished you will be redirected to result page";

//Do long operation here

share|improve this answer
Using the SPLongOperation is an interesting idea, but I am not sure you can get a valid Page object in the event receiver. You would need to specify it to be synchronous and try to cast the page object from the HTTPContext since I don't believe it is provided in the event handler properties. – Chris Beckett May 18 '11 at 6:41
I am willing to try your way. Thanks – Monica Contera May 18 '11 at 17:18

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.