Question

I am trying to pick up the date for each item in a list but I cannot seem to figure out all to get the value.

I am using:

var startDate = listEnumerator.get_current().get_item('Start_x0020_Date')
Was it helpful?

Solution

In your success function, you can try something like below:

function Success() {
    var listEnumerator = collList.getEnumerator();

    while (listEnumerator.moveNext()) {
        var oList = listEnumerator.get_current();
        var startDate = oList.get_item('DateTimeColumnName');  // 'DateTimeColumnName' is internal name of date field
    }
}

You can find the complete code to get the list items using JSOM in below article:

How to: Retrieve Lists Using JavaScript.

How to find internal name of field:

  1. How to get Internal names of columns in sharepoint lists?.
  2. How to check Column Internal Name for a SharePoint List
Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top