1

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')
  • Can you please add complete code to your question? Are you able to get other fields like Single line text/item ID? – Ganesh Sanap Jul 25 at 4:40
0

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
  • I have three different date fields on my list though, how would I differentiate between the three? – spUser01 Jul 25 at 14:12
  • You must be having different internal names for each date and time field. So you can use that. check updated answer to find internal name – Ganesh Sanap Jul 25 at 14:16
  • Is it not working? Try first saving current item in one variable and then fetching StartDate from that item as given in answer instead of writing in one line. – Ganesh Sanap Jul 25 at 14:25
  • If it is working then please upvote(^) and accept as an answer so that it will help others to find the correct answer easily. – Ganesh Sanap Jul 25 at 14:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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