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

Suppose I have a custom timer job that processes work items. How can I check whether the timer job has processed a specific SPWorkItem without interfering with the actual processing?

If I try to initialize an SPWorkItemCollection using SPSite and the work item type's ID, I can get a reference to the work item. But initializing that collection also seems to remove the work item from the queue!

I tried calling SPWorkItemCollection.RevertInProgressWorkItem, but that doesn't seem to do anything. If I reinitialize the SPWorkItemCollection, it doesn't contain my work item anymore.

share|improve this question
up vote 1 down vote accepted

You have to get a subcollection and work on that. Apparently you need to do this to set the parent web. Assuming workItems is your SPWorkItemCollection:

var subWorkItems = workItems.SubCollection(site, web, 0, (uint)workItems.Count);

Now call methods such as RevertInProgressWorkItem on subWorkItems.

I also found that this puts the item back on the queue but with a delivery time 10 minutes in the future. You change this by setting the delivery time explicitly.

Waldek has a good blog post on work item timer jobs.

share|improve this answer

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.