0

this code i have only gets current item that are added, but i want to get all items that are created,

ntext.executeQueryAsync(
        function() {


            var camlQuery = new SP.CamlQuery();


            camlQuery.set_viewXml('<View><Query><Where><And><Gt><FieldRef Name=\'EventDate\' /><Value IncludeTimeValue=\'TRUE\' Type=\'DateTime\'>'
                + fromTime.toISOString() + '</Value></Gt><Gt><FieldRef Name=\'EndDate\' /><Value IncludeTimeValue=\'TRUE\' Type=\'DateTime\'>' + toTime.toISOString() +
                '</Value></Gt></And></Where></Query></View>');
            this.collListItem = list.getItems(camlQuery);
            context.load(collListItem);
            var listItemEnumerator = collListItem.getEnumerator();
            while (listItemEnumerator.moveNext()) {
                var oListItem = listItemEnumerator.get_current();
                var listDetails = oListItem.get_item('EventDate') +"      " + oListItem.get_item('EndDate');
                result = result + listDetails;

                alert(result);

            }
3
  • You mean all items in the list? Dec 1, 2014 at 13:50
  • Yes and only display date and time to and from
    – Batistuta
    Dec 1, 2014 at 13:52
  • I want first to display are items that are created in the list, but i also want to display Dates and times that are free to add in calender list @AmalHashim
    – Batistuta
    Dec 1, 2014 at 13:55

1 Answer 1

0

Use below

var camlQuery = new SP.CamlQuery();
camlQuery.set_viewXml('<View><RowLimit>1000</RowLimit></View>');
this.collListItem = list.getItems(camlQuery);
context.load(collListItem, 'Include(EventDate,EndDate)');
var listItemEnumerator = collListItem.getEnumerator();
while (listItemEnumerator.moveNext()) {
    var oListItem = listItemEnumerator.get_current();
    var listDetails = oListItem.get_item('EventDate') +"      " + oListItem.get_item('EndDate');
    result = result + listDetails;
    alert(result);
}
1
  • Alright how could i then display for the user available free dates to add in the calender list in an range 5 days based on want the user has added in my textboxes from and to date?
    – Batistuta
    Dec 1, 2014 at 14:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.