CAML Query did not return result for Date Range query

Having developing SharePoint for so many years, I just got to know that you CANNOT perform CAML Query for Date Range where your ISO Value is a DateTime.MinValue.

CAML Query does not support Date Value of DateTime.MinValue

SPUtility.CreateISO8601DateTimeFromSystemDateTime(DateTime.MinValue)

For example, if you were to query the Event Date Time from day 1

<Geq> 
 <FieldRef Name='EventDate' />
 <Value IncludeTimeValue='FALSE' Type = 'DateTime'>" + 
SPUtility.CreateISO8601DateTimeFromSystemDateTime(DateTime.MinValue) + @" </Value>
 </Geq>

DO NOT DO this. You will never get any result. The minimal value that you can insert (had some googling around the web), is 1900/01/01.

Just make sure you conduct a date time in 1900 year onwards and you will be safe.

Leave a Reply

Your email address will not be published. Required fields are marked *

AlphaOmega Captcha Classica  –  Enter Security Code