SPLongOperation class has two properties,
TrailingHTML, that can be used to set two areas in the default Long Operation modal dialog when the job starts. Unfortunately, although you can change these properties while the job is in progress, the change isn't reflected in the dialog.
This blog post provides a custom
SPLongOperation descendant that can make these changes appear on the dialog. Basically, how it works is:
- Wrap the initial
TrailingHTML values in
span elements with known IDs.
Response.Flush that replaces the content of the relevant
span with the new value.
(Aside: this class calls
Flush on the supplied
Response property. Because I couldn't figure out what this
Page should be, I wrote custom code instead of using the class and used
HttpContext.Current.Response instead. This seemed to work, but my updates always seemed to be one update behind, so I had to put in a dummy
Flush after each real one.)
You should be able to use this for what you need - either directly use the supplied class in place of your operation, or take a look inside and emulate it yourself.
Also, in SharePoint 2010 (and maybe before, for all I know) there's the
SPStatefulLongOperation class. It's not very well documented, but here's an example of how I might be using it.
"Applying theme to sites.",
foreach (SPWeb web in site.AllWebs)
"document.all.item('trailingSpan').innerText = '" +
This works very similarly to the custom method above: every second, the value of
state.Status is written to the