1
所以,我一直在我的SharePoint应用中使用这个查询几个月,并且它一直工作得很好。但我只是意识到,如果我试图得到的一个月的分月份像7月31日到8月4日,它将只会返回7月31日的清单项目?我已经尝试了所有我能想到的方法来实现这个目标,并且一无所获。我如何使它起作用?我很茫然。尝试使用daterange重叠标记,它只是失败了查询,尝试了我能想到的每个其他格式的日期,只是返回一个空的枚举器。通过MSDN看了好几个小时,在这个问题上没有任何帮助,搜索谷歌和堆栈溢出了几个小时,并找不到这个问题的答案。它工作得很好,在我所有的querys除了CAML查询不能正常工作,当星期已经分了个月,即只有第三十一第四只返回31st
startDate = startDate.toISOString();
endDate = endDate.toISOString();
var camlQuery = new SP.CamlQuery();
var filterString = '<View><Query>';
filterString = filterString + '<Where>';
filterString = filterString + '<And>';
filterString = filterString + '<Geq>';
filterString = filterString + '<FieldRef Name=\'EstimatedDelivery\'/>';
filterString = filterString + '<Value IncludeTimeValue=\'TRUE\' Type = \'DateTime\'>' + startDate + '</Value>';
filterString = filterString + '</Geq>';
filterString = filterString + '<Leq>';
filterString = filterString + '<FieldRef Name=\'EstimatedDelivery\'/>';
filterString = filterString + '<Value IncludeTimeValue=\'TRUE\' Type = \'DateTime\'>' + endDate + '</Value>';
filterString = filterString + '</Leq>';
filterString = filterString + '</And>';
filterString = filterString +'</Where>';
filterString = filterString + '</Query></View>';
<View>
<Query>
<Where>
<And>
<Geq>
<FieldRef Name='EstimatedDelivery'/>
<Value IncludeTimeValue='TRUE' Type='DateTime'>startDate</Value>
</Geq>
<Leq>
<FieldRef Name='EstimatedDelivery'/>
<Value IncludeTimeValue='TRUE' Type='DateTime'>endDate</Value>
</Leq>
</And>
</Where>
</Query>
</View>