javascript - CAML query not working when week has split month i.e 31st-4th only return 31st -
so, have been using query in sharepoint app months , has worked fine. realized if week i'm trying has split month july 31st august 4th, return list items july 31st??? i've tried can think of work , nothing. how work? i'm @ loss. tried using daterange overlap tag, fails query, tried every other format of date think of, returns empty enumerator. looked through msdn hours, no on issue, searched google , stack overflow few hours , can not find answer question. works fine in querys except
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>
seems no 1 can figure out why caml fails on weeks split 2 months, changed out caml queries rest calls , works , 12 times faster!
var url = "/_api/web/lists/getbytitle('listname')/items?" + "$orderby=estimateddelivery&$filter=estimateddelivery ge datetime'" + startdate + "' , estimateddelivery le datetime'" + enddate + "'"; getitems(url, retrievecalendarlistitemssucceeded); function getitems(url, callback) { $.ajax({ url: _sppagecontextinfo.webabsoluteurl + url, type: "get", headers: { "accept": "application/json;odata=verbose", }, success: function (data) { callback(data.d.results); }, error: function (error) { alert(json.stringify(error)); } }); }
Comments
Post a Comment