Sharepoint 是否使用CAML筛选器从列表中获取当前月份?
在SharePoint 2010中,我需要根据条件从列表中获取项目。考虑其中一个字段为DateTime类型的“日期”,条件为: 获取当前月份的数据 如何使用CAML查询根据此条件筛选列表项 由, Raji用于创建相关的日期时间字符串Sharepoint 是否使用CAML筛选器从列表中获取当前月份?,sharepoint,caml,Sharepoint,Caml,在SharePoint 2010中,我需要根据条件从列表中获取项目。考虑其中一个字段为DateTime类型的“日期”,条件为: 获取当前月份的数据 如何使用CAML查询根据此条件筛选列表项 由, Raji用于创建相关的日期时间字符串 DateTime firstDay = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1); Sting stringQuery = String.Format(@"<And>
DateTime firstDay = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1);
Sting stringQuery =
String.Format(@"<And>
<Geq>
<FieldRef Name='Date' />
<Value Type='DateTime'>{0}</Value>
</Geq>
<Leq>
<FieldRef Name='Date' />
<Value Type='DateTime'>{1}</Value>
</Leq>
</And>",
SPUtility.CreateISO8601DateTimeFromSystemDateTime(firstDay),
SPUtility.CreateISO8601DateTimeFromSystemDateTime(firstDay .AddMonths(1)));
SPQuery query = new SPQuery(stringQuery);
DateTime firstDay=newdatetime(DateTime.Now.Year,DateTime.Now.Month,1);
Sting stringQuery=
String.Format(@)
{0}
{1}
",
SPUtility.CreateISO8601DateTimeFromSystemDateTime(第一天),
SPUtility.CreateISO8601DateTimeFromSystemDateTime(firstDay.AddMonths(1));
SPQuery查询=新的SPQuery(stringQuery);