SharePoint 2013 DateTime字段查询

SharePoint 中对DateTime字段的查询需要主要以下两点:

1、参数值需要转换

DateTime tiem = DateTime.Parse("2017-11-29");
var sTime = SPUtility.CreateISO8601DateTimeFromSystemDateTime(tiem);

2、Caml语句需要加查询字段的Value需要加IncludeTimeValue=’TRUE’

var caml = @"<Where><And><Gt><FieldRef Name='Created' />" +
                    "<Value IncludeTimeValue='TRUE' Type='DateTime'>" + startTime + "</Value></Gt>" +
                    "<Lt><FieldRef Name='Created' /><Value IncludeTimeValue='TRUE' Type='DateTime'>" + endTime + "</Value></Lt></And></Where>";

猜你喜欢

转载自blog.csdn.net/u012835032/article/details/78664115