How to Get list last modified date time in SharePoint

Hello friends, in this article we will see a Rest API function to get the list last modified date in Sharepoint. In some cases, we may need to find the last modified date of the latest item from the Sharepoint list.

Below Rest API function can be used to get the last item modified date time



Get list last modified date in SharePoint

getListLastModifiedDate = function (siteUrl, listName) {
  var def = $.Deferred();
  $.ajax({
    url: siteUrl + "/_api/web/lists/GetByTitle('" + listName + "')/LastItemModifiedDate",
    type: 'GET',
    headers: {
      accept: "application/json;odata=minimalmetadata"
    },
    success: function (response) {
      def.resolve(response.value);
    },
    error: function (xhr, status, error) {
      def.reject('01/01/01');
      console.log(xhr.responseText + "\n" + error);
    }
  });
};

Post a Comment

0 Comments