cd ../blog

The Small Snake That Always Bites Us: Timer Jobs

The SharePoint Content Processing timer job disables event receivers while routing documents — use a workflow instead of ItemAdded to handle post-routing logic.

</>

So yesterday was final testing day — everything came together with all the solutions we built over the past few weeks.

The manual process was working fine: documents from the first Drop-Off library routed correctly to the second Drop-Off library on the subsite. We then ran the PowerShell command to push 1000 test documents into the root web’s Drop-Off library. The timer job ran… and everything seemed fine. “Seemed” being the key word.

The Problem

All 1000 documents were routed to the subsite’s Drop-Off library. But my ItemAdded event handler on that library was never triggered. Not once.

The only logical conclusion: the Content Processing timer job disables event firing while it routes documents — it calls EventFiringEnabled = false (or the equivalent) during its operation, then re-enables it afterward. So events placed during the timer job run are silently swallowed.

The Fix

Instead of an event handler on ItemAdded, use a workflow that executes the same logic.

Benefits:

  • Works correctly even when documents arrive via the timer job
  • You get the workflow history mechanism as an additional tracking/audit trail for free (thanks Tom for the help! 😊)

Lesson learned: if you’re using Content Organizer routing via timer job and need post-routing logic, workflows are your friend.