When using Client-Side Object Model for SharePoint 2013, how can I access previous versions of List Item?

  • 2
    It looks to me this is not possible, perhaps not even through the REST interface either. I can do it on files, e.g., ctx.get_web().get_lists().getByTitle('Test').getItemById(1).get_files().get_versions(), but not on pure SP.ListItem. Although it should be possible through SPServices. – eirikb Nov 15 '12 at 20:40
  • 2
    @erikb are you able to convert this into a full answer for acceptance, I believe you are perfectly correct. – Hugh Wood Dec 7 '12 at 21:06

According to this article


should provide the collection you are looking for.

Be careful: SPListItem.Versions and SPListItem.File.Versions are different.

| improve this answer | |
  • 2
    Unfortunately it is not correct,since the link you provided for SSOM. JSOM (and CSOM) SP.ListItem object does not expose Versions property – Vadim Gremyachev Dec 17 '14 at 15:47
  • Exactly this is not CSOM, but SSOM – michalh Nov 14 '16 at 9:22

If you have a document library use:
JSOM: .get_file().get_versions()
REST: ../File/Versions

However if you have a normal list this won't work, but instead you can request the item file directly. This is a hack and I can't guarantee future support:

var itemFileUrl = 
  _spPageContextInfo.webServerRelativeUrl + 
  "Lists/" + listName + "/" + itemId + "_.000";

JSOM: .get_web().getFileByServerRelativeUrl(itemFileUrl).get_versions()
REST: "_api/Web/GetFileByServerRelativeUrl('" + itemFileUrl + "')/Versions

You can also use SPServices although I'm not sure this will work with CORS.

| improve this answer | |
  • 1
    File versions and ListItem versions are not the same thing... – michalh Nov 14 '16 at 9:23

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.