1

I have the following timer job, not done by me.

When I attach debugger to OWSTIMER.EXE the constructors are triggered but the ProcessWorkItem method is never step into.

There are about 4000 workitems on the scheduledworkitems table. so I dont know whats wrong.

class MoveRequestWorkItemTimerJob : SPWorkItemJobDefinition
    {
        string requestNumber = null;
        SPListItem statusItem = null;
        // Constructor
        public MoveRequestWorkItemTimerJob()
            : base()
        {
        }

        // Constructor
        public MoveRequestWorkItemTimerJob(string name, SPWebApplication webApp)
            : base(name, webApp)
        {
        }

        // Guid of work items to be processed by this job
        public override Guid WorkItemType()
        {
            // replace with your own Guid
            Guid g = new Guid("34EC0602-B18B-418C-8CAA-77FF9E4CF3F7");
            return g;
        }

        public override int BatchFetchLimit 
        { 
            get 
            { 
                return 1000; 
            } 
        }

        protected override bool ProcessWorkItem(SPContentDatabase contentDatabase,
            SPWorkItemCollection workItems, SPWorkItem workItem, SPJobState jobState)
        {

1 Answer 1

1

This method is called by the timer job framework on each occurrence of the timer job schedule AND ONLY IF work items have been queue for this timer job based on its WorkItemType Guid.

http://sharepintblog.com/2011/12/12/spworkitemjobdefinition-a-different-kind-of-sharepoint-timer-job/

1
  • I suppose if I check that table, the workitemtype id should match: 34EC0602-B18B-418C-8CAA-77FF9E4CF3F7 Nov 28, 2012 at 10:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.