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>