Category Archives: SharePoint 2016

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.

Create a Page in SharePoint sub site is not adding to the sub site but the Root site

I hope the post title did not confuse you. I hit this weird behaviour in SharePoint when I was in “www.sharepoint.com/subsite” trying to create a Page in “www.sharepoint.com/subsite/pages” library. The dialog shows URL of Root Site in “Find It at”

create a page not adding to correct site 1

If you proceed to create the page, it will be added into ROOT SITE! which is not what I wanted

Resolution

To avoid confusing and to make the “add a page” adds pages to the correct site. Please do the following:

  1. Go to your sub site setting page
  2. Go to “Navigation” under look and feel section
  3. Uncheck the field “
  4. Click “OK” an save

Once you have unchecked the field, your “add a page” is now adding to the correct subsite!