Skip to main content


Go Search

Boman.Biz > Posts > Changing the message during a Microsoft.SharePoint.SPLongOperation
Changing the message during a Microsoft.SharePoint.SPLongOperation

The SPLongOperation is undoubtedly a Good Thing® to let users know that something is happening during a long processing operation. I had cause to use one the other day, and thought that it would be great to be able to change the message during the processing to let the user know which part of the Long Operation it was up to.

For example:

Using objLongOp As New SPLongOperation(Me.Page)

objLongOp.LeadingHTML = "Leading HTML"

objLongOp.TrailingHTML = "Trailing HTML"






objLongOp.LeadingHTML = "New Leading HTML"

objLongOp.TrailingHTML = "New Trailing HTML"





End Using


Would result in this screen, for 6 seconds:

I wrote a wrapper class called SPLongOperationEx to make sure that in our example after the first 3 seconds the LeadingHTML and TrailingHTML text is updated with the new values. This way you can have much longer Long Operations and still keep the user happy J

3 seconds later ...

This is a fairly trivial programming exercise once you understand how the SPLongOperation class is manipulating the browser, but I thought I would package it up into a separate class for easy re-use to save people some time.

Download the SPLongOperationEx Class here. (VB.NET)

Thanks to my good friend Adrian Bear from i-PMO, here is the C# version with support for line breaks in the message:

Download the SPLongOperationEX Class here. (C#)



Hi, great idea but it´s not working in my environemnt WSS 3.0 SP2. The sptLeading element can not be found. Have you found the same error?
at 19/03/2010 12:20 AM

Use LongRunningOperationJob insted

Use LongRunningOperationJob to change the message during the processing to let the user know which part of the Long Operation it was up to.
at 21/01/2011 5:29 PM


Simple !! good job
at 22/09/2011 1:22 AM


Works great with Internet Explorer but does not work in Firefox. Any ideas?
at 23/12/2011 8:47 PM

at 11/09/2015 3:07 PM


vegetables soaked in the water." Cook put his head down one side of said back side of the basket, facial features exposed Jisi dejected. Hard edge of the mountain cuisine is the most common vegetables, you need to be soaked in water before eating all day, repeatedly changed his water, then boiling water over cooked salad, tastes fresh in slightly mixed with a little bitterness, it is refreshing . Because it is necessary for each peasant dishes on the table, the daughter of a poor family has helped four or five large pick in the hills parents struggling dish, how her mother would forget? I'm afraid because we know that the disease has been done to Liu and his friends to eat, so deliberately into it. Cloud song looked left half basket of hard disc dish made will stay, suddenly pointing Meng Jue, a look surprised, "You ...... you ......" eldest son drove, said: "he is eating heavier taste He ...... "Meng Jue smile, fine, clear," I was brought up eating flavor. "Then how do you think I did not do the dishes taste light daily? Cloud song confused mind, but also to ask. The eldest son shook his bottle of wine, laughing, said: "Tomorrow one another, good-bye, I am afraid to for some time, may wish to indulge in a drunk tonight Xu girl, your wine is really good wine, I do not know what was the name! ? "" Nothing name, my wines are sold Pungent, people outside casually called Pungent wine. "cloud song containing a mouthful of wine, quietly product for a while," Xu sister, as called Trimeresurus it! This wine If you pay attention to some, tribute wine made on the choice of materials brewing. "eldest son clap and laugh," a good name, a pale wine mellowness, coupled Trimeresurus name, good wine in a gentleman, a gentleman of wine. "Empress Xu Pingjun with a smile: "I did not read the book, you are literate people, you say good enough." Although it is bread and water, you can chat in five people with laughter rice, but also eat articulate hold in the mouth fragrant. Several people have been somewhat slightly tipsy, and this person is not bound by it, have casual attitude up. Eldest son supine on tung oil cloth, enjoying the starry. Meng Jue half against behind the tree, a jug of wine in hand, laughing and looking at the cloud song Pinjiu Empress Xu Pingjun fighting grass. Because tung oil cloth was the eldest son took up more than half, Liu disease has simply lying sideways on the grass, one hand supporting his head, stood in front of a big bowl of wine, drink a drink when Wanbian directly conspire on a big mouth, this time is smiling watching the cloud song and Empress Xu Pingjun. Cloud song and Empress Xu Pingjun two side on the Walk of groping to find grass, while fighting grass Pinjiu. Yake is not a scholar of popular Wendou, with mutual form the antithesis Poetry and Fu reported nickname, grass name, more than those for the win. But the fields of farmers resorting to violence, they put their grass with hook, reverse direction pull, broken by then lost, lost to drink a cup of natural. Cloud song effort to find grass Empress Xu Pingjun difference was even greater than the galaxy than ten blades of grass inside eight to lose, already more than half Empress Xu Pingjun drink a pot of wine. Cloud song lose more anxious, a person bent body in the grass fumble. Mouth and face 
at 26/09/2015 6:02 PM


vegetables soaked in the water." Cook put his head down one side of said back side of the basket, facial features exposed Jisi dejected. Hard edge of the mountain cuisine is the most common vegetables, you need to be soaked in water before eating all day, repeatedly changed his water, then boiling water over cooked salad, tastes fresh in slightly mixed with a little bitterness, it is refreshing . Because it is necessary for each peasant dishes on the table, the daughter of a poor family has helped four or five large pick in the hills parents struggling dish, how her mother would forget? I'm afraid because we know that the disease has been done to Liu and his friends to eat, so deliberately into it. Cloud song looked left half basket of hard disc dish made will stay, suddenly pointing Meng Jue, a look surprised, "You ...... you ......" eldest son drove, said: "he is eating heavier taste He ...... "Meng Jue smile, fine, clear," I was brought up eating flavor. "Then how do you think I did not do the dishes taste light daily? Cloud song confused mind, but also to ask. The eldest son shook his bottle of wine, laughing, said: "Tomorrow one another, good-bye, I am afraid to for some time, may wish to indulge in a drunk tonight Xu girl, your wine is really good wine, I do not know what was the name! ? "" Nothing name, my wines are sold Pungent, people outside casually called Pungent wine. "cloud song containing a mouthful of wine, quietly product for a while," Xu sister, as called Trimeresurus it! This wine If you pay attention to some, tribute wine made on the choice of materials brewing. "eldest son clap and laugh," a good name, a pale wine mellowness, coupled Trimeresurus name, good wine in a gentleman, a gentleman of wine. "Empress Xu Pingjun with a smile: "I did not read the book, you are literate people, you say good enough." Although it is bread and water, you can chat in five people with laughter rice, but also eat articulate hold in the mouth fragrant. Several people have been somewhat slightly tipsy, and this person is not bound by it, have casual attitude up. Eldest son supine on tung oil cloth, enjoying the starry. Meng Jue half against behind the tree, a jug of wine in hand, laughing and looking at the cloud song Pinjiu Empress Xu Pingjun fighting grass. Because tung oil cloth was the eldest son took up more than half, Liu disease has simply lying sideways on the grass, one hand supporting his head, stood in front of a big bowl of wine, drink a drink when Wanbian directly conspire on a big mouth, this time is smiling watching the cloud song and Empress Xu Pingjun. Cloud song and Empress Xu Pingjun two side on the Walk of groping to find grass, while fighting grass Pinjiu. Yake is not a scholar of popular Wendou, with mutual form the antithesis Poetry and Fu reported nickname, grass name, more than those for the win. But the fields of farmers resorting to violence, they put their grass with hook, reverse direction pull, broken by then lost, lost to drink a cup of natural. Cloud song effort to find grass Empress Xu Pingjun difference was even greater than the galaxy than ten blades of grass inside eight to lose, already more than half Empress Xu Pingjun drink a pot of wine. Cloud song lose more anxious, a person bent body in the grass fumble. Mouth and face 
at 26/09/2015 6:07 PM

Add Comment


Body *

From *

(not rendered on the page)

If you are commenting to add SPAM - what is your motivation? *

What is 7+3-5? *