Skip to main content
Boman.Biz

Boman.Biz

Go Search
Home
  

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.Begin()

 

System.Threading.Thread.CurrentThread.Sleep(3000)

 

objLongOp.LeadingHTML = "New Leading HTML"

objLongOp.TrailingHTML = "New Trailing HTML"

 

System.Threading.Thread.CurrentThread.Sleep(3000)

 

objLongOp.End(Me.Page.Request.Url.ToString())

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#)

Comments

Update?

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

Thanks

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

Firefox?

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

Coach

at 1/11/2014 4:03 PM

dsdsasda

http://www.montrepas-cher.fr/, http://www.ugg-australia.it/, http://www.nike-freerunning.co.uk/, http://www.insanityworkouts.in.net/, http://www.herveleger.in.net/, http://www.hermes-sac.fr/, http://www.conversepascher.fr/, http://www.monclerjacketsoutlet.in.net/, http://www.barbourjackets.me.uk/, http://www.doudoune-canadagoosepascher.fr/, http://www.juicycoutureoutlet.jp.net/, http://www.soccerjerseys.in.net/, http://www.raybansunglasses.in.net/, http://www.sacvanessabruno.fr/, http://www.montblancpens.in.net/, http://www.louisvuittoncanada.ca/, http://www.nike-airmax.it/, http://www.sac-longchamps.fr/, http://www.canadagoosejakkernorge.net/, http://www.cheap-weddingdresses.co.uk/, http://www.moncler-outlet.it/, http://www.nikeair-max.fr/, http://www.converse--shoes.com/, http://www.hollister-abercrombiefitch.fr/, http://www.canadagoose.me.uk/, http://www.jimmychooshoes.in.net/, http://www.pradaoutlet.in.net/, http://www.thenorthfaceoutlet.in.net/, http://www.longchampbags.me.uk/, http://www.hollister.me.uk/, http://www.oakley--sunglasses.in.net/, http://www.tiffanyandco-jewelry.in.net/, http://www.louisvuitton.in.net/, http://www.nikeoutlet.in.net/, http://www.true-religion.in.net/, http://www.moncler-jacka.com/, http://www.red-bottomshoes.in.net/, http://www.canada--goose.se/, http://www.vans-scarpe.it/, http://www.nike--trainers.co.uk/, http://www.hermesbirkin-bags.in.net/, http://www.burberryoutlet-online.in.net/, http://www.abercrombieandfitch.in.net/, http://www.rayban-sunglasses.me.uk/, http://www.michaelkorsoutlet-online.us.com/, http://www.airjordanpas-cher.fr/, http://www.sacguesspascher.fr/, http://www.jordanshoes.in.net/, http://www.pandoracharms.in.net/, http://www.sac-lancelpascher.fr/, http://www.karenmillen--dresses.co.uk/, http://www.baseballbats.in.net/, http://www.mcmhandbags.in.net/, http://www.toms-shoes.in.net/, http://www.timberlandboots.in.net/, http://www.rayban-sunglasses.in.net/, http://www.soccershoes.in.net/, http://www.timberland-pas-cher.fr/, http://www.chanelhandbags.eu.com/, http://www.nikeairforce.fr/, http://www.bottes-uggpascher.fr/, http://www.christianlouboutin-shoes.in.net/, http://www.nike-rosherun.co.uk/, http://www.burberryoutlet.eu.com/, http://www.hollister-abercrombie.es/, http://www.niketnrequin-pascher.fr/, http://www.longchamphandbagsoutlet.us.com/, http://www.katespadehandbags.in.net/, http://www.rolex-replicawatches.us.com/, http://www.uggboots-uggs.co.uk/, http://www.pololacoste-pascher.fr/, http://www.uggs-outlet.in.net/, http://www.canadagooseoutlet.in.net/, http://www.michaelkorshandbags.in.net/, http://www.ferragamo-shoes.in.net/, http://www.lunetterayban-pas-cher.fr/, http://www.moncler--jackets.co.uk/, http://www.nike-airmax.nl/, http://www.borse-louisvuitton.it/, http://www.polo-ralphlauren-pascher.fr/, http://www.christian-louboutin.me.uk/, http://www.lunetteoakley-pascher.fr/, http://www.the--northface.co.uk/, http://www.longchampoutletonline.in.net/, http://www.ray--ban.it/, http://www.nikeairmax-pas-cher.fr/, http://www.michaelkorsoutletstore.in.net/, http://www.converse-all-star.it/, http://www.coachoutlet.jp.net/, http://www.the-northface.fr/, http://www.truereligion-jeans.in.net/, http://www.oakleysunglasses.jp.net/, http://www.louis-vuittonhandbags.co.uk/, http://www.new--balance.fr/, http://www.bottegaveneta-handbagsoutlet.com/, http://www.p90x-workout.us.com/, http://www.celinehandbags.in.net/, http://www.michaelkorsoutlet-canada.ca/, http://www.occhiali--oakley.it/, http://www.nikerosherun.in.net/, http://www.sacmichaelkors-pascher.fr/, http://www.michaelkorsoutlet.in.net/, http://www.nikefreerun.in.net/, http://www.polo-ralphlauren.in.net/, http://www.canadagoose-jackets.ca/, http://www.coachpurses.in.net/, http://www.moncler-online-shop.de/, http://www.saclongchamp-pas-cher.fr/, http://www.valentinoshoes.in.net/, http://www.canadagoose-jackets.in.net/, http://www.sac--louisvuitton.fr/, http://www.replica--watches.me.uk/, http://www.uggs-canada.ca/, http://www.vans-shoes-outlet.com/, http://www.pandoracharmsuk.me.uk/, http://www.thomassabouk.me.uk/, http://www.cheapnfljersey-outlet.com/, http://www.louisvuittonoutlet.in.net/, http://www.abercrombie-hollister.it/, http://www.louisvuittonhandbags.in.net/, http://www.nikefreerun.fr/, http://www.chiflatiron.cn.com/, http://www.pandora-jewelry.in.net/, http://www.truereligion.in.net/, http://www.nikeblazer-pascher.fr/, http://www.nikeairmax.in.net/, http://www.hollister-clothing-store.com/, http://www.doudoune--moncler.fr/, http://www.louisvuittonoutletstores.in.net/, http://www.ralphlaurenoutlet-uk.co.uk/, http://www.parajumpers.in.net/, http://www.coachoutletstoreonline.jp.net/, http://www.vanspas-cher.fr/, http://www.newbalanceshoes.in.net/, http://www.polo-ralphlauren.it/, http://www.abercrombie-andfitch.co.uk/, http://www.uggsoutletboots.in.net/, http://www.ugg-pas-cher.fr/, http://www.truereligionoutlet.in.net/, http://www.coachfactoryoutlet-online.in.net/, http://www.nikeairmaxa.co.uk/, http://www.nikeairhuarache.co.uk/, http://www.nikeairmaxinc.com/, http://www.louisvuittonoutletonline.in.net/, http://www.asicso.com/, http://www.guccihandbagsoutlet.in.net/, http://www.pradahandbags.in.net/, http://www.outletonline-michaelkors.com/, http://www.swarovskijewelry.in.net/, http://www.louboutin--pascher.fr/, http://www.uggs-boots.in.net/, http://www.michael-kors-outlet-online.us.com/, http://www.longchamphandbags.us.com/, http://www.sacburberry-pascher.fr/, http://www.borse-gucci.it/, http://www.nike-rosherun.fr/, http://www.swarovski-uk.me.uk/, http://www.oakley-sunglasses.in.net/, http://www.reebokoutlet.in.net/, http://www.scarpe-hoganoutlet.it/, http://www.linksoflondon.me.uk/, http://www.michaelkorshandbags-uk.co.uk/, http://www.marcjacobshandbags.in.net/, http://www.mac-cosmetics.in.net/, http://www.supra--shoes.com/, http://www.canadagoose.in.net/, http://www.christianlouboutin-outlet.in.net/, http://www.iphonecases.in.net/, http://www.babylisspro.us.com/, http://coachofficialsite.blog.com/, http://www.tiffany-and-co.in.net/, http://www.toryburchoutlet-online.in.net/, http://www.giuseppezanotti.in.net/, http://www.louboutinscarpe.it/, http://www.northface-jackets.us.com/, http://www.nikeairmaxe.co.uk/, http://www.lululemon-outlet.in.net/, http://www.instylerionicstyler.us.com/, http://www.katespadeoutletonline.in.net/, http://www.louisvuitton-pascher.fr/, http://www.moncler-jackets.com/, http://www.lululemonoutlet-canada.ca/, http://www.juicycoutureoutlet.in.net/, http://www.beatsbydrdre-headphones.in.net/, http://www.weddingdresses.in.net/, http://www.hollister-canada.ca/, http://www.poloralphlaurenoutlet.in.net/, http://www.mulberryhandbags-outlet.co.uk/, http://www.ghd-hair-straighteners.co.uk/
at 15/11/2014 10:57 AM

Add Comment

Title


Body *


From *


(not rendered on the page)

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


Attachments