Home > CMS- Content Management System > Sharepoint > How to read the version history of Multiline column from list in office 365/ SharePoint 2013 page?

How to read the version history of Multiline column from list in office 365/ SharePoint 2013 page?

This post was most recently updated on August 5th, 2024

Before we go through our actual goal first we discuss about SharePoint versioning.

Within SharePoint list or library, you ability to add column that are type multi-line text field.  Within this column setting you have option ‘Append Changes to Existing Text‘.

“You must first turn on versioning in this list before adding or creating columns which append changes to existing text.”

Follow the steps below to enable versioning and column level settings

  • Turn on versioning on the list Settings > List Settings > Versioning SettingsCreate a version each time you edit an item in this list? Check ‘Yes’
  • Change (or add a new) Multiple Lines of Text field and set Append Changes to Existing Text

If you turn on versioning to list and set field is Append only mean SharePoint keep track of updates all items in list on each edit and show versions in form of user name, date time with comment text.

We need to use SP Service “GetVersionCollection” method to read the item data as Rest and CSOM does not support reading the version history of the submitted item

Follow the steps below to read all the version data from comment column.

Steps: Page level

  • Create page and add following datatable css and js.

    <link rel=”stylesheet” type=”text/css” href=”https://cdn.datatables.net/1.10.12/css/jquery.dataTables.min.css” />
    <script src=”https://code.jquery.com/jquery-1.12.4.js” type=”text/javascript”></script>
    <script src=”https://microsoft.sharepoint.com/teams/script/jquery.SPServices-2014.02.js”></script>
    <script type=”text/javascript” src=”https://cdn.datatables.net/1.10.15/js/jquery.dataTables.min.js”></script>

  • Create table with header according to SharePoint list.

Steps: JS Level

  • Step 1: We need to get item count of threshold exceed list by GetItemCount () function.

  • Step 2: Next step create rest service url without specifying comment column in string.  Here we splitting rest call according to item count of GetItemCount () function. Check item count if item count is above 5000 then we split calling with 1000 item per call top=1000 for better performance. Otherwise we call as usual i.e. top=5000.

  • Step 3: In this step we process each item of threshold list by repeatedly calling getJSONDataFromUrl () function. GetJSONDataFromUrl () function gives Ajax json object.

  • Step 4: At a time of processing we also process each item comment by calling getFieldHistory() function and dynamically append comment to each td.

Final Screen shot

 

Reference:

https://sharepoint.stackexchange.com/questions/217254/rest-to-read-more-than-5000-items-from-document-library/217451#217451

 

This Article is TAGGED in , , , , . BOOKMARK THE permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">