I am trying to read the comments of a task list in SharePoint 2016 by using JavaScript.

Right now I get the latest comment using:

var comment = oListItem.get_item('Comments');

But how can I read all comments and how I can get more information like the person who wrote this comment?

  • Is "Append Changes to Existing Text" is set to "Yes" for your Comments column? Feb 10, 2020 at 10:50
  • Yes, it is.....
    – cvb
    Feb 10, 2020 at 12:43

1 Answer 1


you can use the below code to get the version history of Comments field,

function getFieldHistory (itemId, fieldName) { //Get each item version history with comment using SPServices

var HTML='';
var ItemID ="", AdditionalComments= "";
var i = 1;
           operation: "GetVersionCollection",
           strlistID: "{A4538568-2FC1-44E2-BAFC-D5DB2C64FF0D}",
           strlistItemID: itemId,
           strFieldName: fieldName,
           completefunc: function (xData, Status) {
                        var xmlDoc = $.parseXML(xData.responseText);
                        $xml = $(xmlDoc);                            
                        var values = $xml.find("Versions > Version").each(function () {

                          AdditionalComments = $(this).attr(fieldName);
                          var Editor= $(this).attr("Editor");
                          var temp= $(this).attr("Modified");
              tempModified= new Date(temp);
              Modified=(tempModified.getMonth() + 1) + '/' + tempModified.getDate() + '/' +  tempModified.getFullYear();                                        

            HTML +='<div>'+Editor+' ('+Modified+'): '+AdditionalComments+' | </div><br/>';




for more information, refer the below link,

  1. http://mundrisoft.com/tech-bytes/how-to-read-the-version-history-of-multiline-column-from-list-in-office-365-sharepoint-2013-page/

  2. https://social.technet.microsoft.com/wiki/contents/articles/29559.sharepoint-hosted-apps-working-with-version-history-of-multiple-lines-of-text-column.aspx

  3. https://stackoverflow.com/questions/24423657/sharepoint-2013-get-splistitem-versions-via-rest

  • What is the different between fieldName and feld?
    – cvb
    Feb 10, 2020 at 13:19
  • You need not pass anything for Field, it's just an array to get all the history values Feb 10, 2020 at 13:58
  • I have updated the code, and removed field. Feb 10, 2020 at 14:13
  • yes, thank you. But do you have an idea why i get an "undefined" back?
    – cvb
    Feb 10, 2020 at 14:24
  • Where do you get "undefined" ? you need to set your list id here in this line, strlistID: "{A4538568-2FC1-44E2-BAFC-D5DB2C64FF0D}", Feb 10, 2020 at 14:26

Your Answer

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

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