Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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)
        {
share|improve this question

1 Answer 1

up vote 1 down vote accepted

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/

share|improve this answer
    
I suppose if I check that table, the workitemtype id should match: 34EC0602-B18B-418C-8CAA-77FF9E4CF3F7 –  L.V. Sharepoint Architect Nov 28 '12 at 10:19

Your Answer

 
discard

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.