简体   繁体   English

javascript caml查询返回所有日期值

[英]javascript caml query returning all date values

I'm using a CAML query to get events between two specific dates from a calendar. 我正在使用CAML查询来获取日历中两个特定日期之间的事件。 However, when the query runs it is still returning all of the events with the list. 但是,当查询运行时,它仍返回带有列表的所有事件。 It looks as if it is not applying the 'and' operator correctly. 看起来好像没有正确应用'and'运算符。

My code is: 我的代码是:

camlQuery.set_viewXml('<View><GetListItems><Where><And>' + 
  '<Gt><FieldRef Name="EventDate" /><Value IncludeTimeValue="TRUE" Type="DateTime">' +
  startDate + '</Value></Gt>' + 
  '<Lt><FieldRef Name="EventDate" /><Value IncludeTimeValue="TRUE" Type="DateTime">' +
  endDate + '</Value></Lt></And></Where>' + '
  <ViewFields><FieldRef Name="Title" /><FieldRef Name="EventDate" /></ViewFields>' +
 '<QueryOptions /></GetListItems></View>');

startDate and endDate are converted to ISO8601 format, if I just do the greater part of the caml query then I return all list items after that date. startDate和endDate会转换为ISO8601格式,如果我只是做caml查询的大部分,那么我将在该日期之后返回所有列表项。 It's just when adding in the less than part of the caml query I start getting errors. 只是在添加少于caml查询的一部分时,我开始出现错误。 The caml works fine in U2U query builder. caml在U2U查询构建器中可以正常工作。

Any help would be much appreciated. 任何帮助将非常感激。

我将查询评估程序从和更改为,还删除了标签,这似乎可以解决问题

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM