Part of my timerjob does

DateTime week = DateTime.Now.AddDays(-7);
SPQuery mQuery = new SPQuery();
mQuery.Query = "<Where><Gt><FieldRef Name='myDay' /><Value Type='DateTime' IncludeTimeValue='False'>" + week.Date.ToString() + "</Value></Gt></Where>";


But it always has fieldref='created' and includetime=true no matter what I do.

Edit: I have also tried to change the query completely but anything I put just returns null

I thought maybe it was some sort of SharePoint cache issue but I have retracted, deleted, resetISS, & deployed to find no difference.

My Solution: I uninstalled the assembly from the GAC ( Drive\windows\assembly\ ) then I retracted my solution, resetiss, restart-service SPTimerV4, restarted the machine. Build & deploy. Things worked again

2 Answers 2


Seems like timer job is not getting deployed correctly,

Delete the custom timer job:
how to delete sharepoint timer job using powershell

Then deploy it again with your changes and see if that updates...

  • I have been using powershell to delete everything, although the feature event: onDeactivation only fires when disabled using the UI button. To remedy this I have been deleting each timer job via-powershell aswell as deactivating via-powershell
    – user13186
    Dec 6, 2012 at 23:21

One thing I've found with CAML (and this may or may not actually help you here) is that true != TRUE and false != FALSE. I've been burned by that before. Use all caps there.

Also, fieldRef should be FieldRef.

So the CAML to try would be:

"<Where>" +
  "<Gt>" +
    "<FieldRef Name='myDate'/>" +
    "<Value Type='DateTime' IncludeTimeValue='FALSE'>" + days.date.ToString() + "</Value>" +
  "</Gt>" +

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.