0

I am trying to find a method to open every list Item's version history, get the Version No., Modified dateTime, and Modified By, and then aggregate it into a master csv.

I need to aggregate every version for every item into one list. It will be a very large output, clearly.

I imagine it would use this url and advance/loop to the next Item ID as the suffix on this url:

https://site/list/_layouts/15/versions.aspx?list=[listidNumber]&ID=133

Possible? Looking for ideas as well. I understand JQuery and can tweak it, but cannot write it cold.

Many thanks-

2
  • Is this for a regular list, or for a document library? Apr 22 '20 at 17:51
  • A custom List. Thanks.
    – ChasEpes
    Apr 22 '20 at 18:32
0

Please check this post: How to get version history of item using REST

It describes the necessary steps to load version history using SharePoint REST API. I hope it will help you to fetch all the data you want by adding them in the $select query option.

For SharePoint Online:

$.ajax({
    url: _spPageContextInfo.webAbsoluteUrl + 
        "/_api/web/Lists/getbytitle('JobTitles')/items(1)/versions?$select=Title,VersionLabel",
    async: false,
    headers: {
        'accept': 'application/json;odata=nometadata'
    },
    complete: function(request) {
        console.log("CurrentUser: " + JSON.stringify(request, null, 4));
    },
    error: function(request) {
        console.log(JSON.stringify(request, null, 4));
    }
});

For SharePoint 2013 they have prescribed to use the following API endpoint:

https://{site_url}/_api/web/GetFileByServerRelativeUrl('/sites/siteName/Lists/listName/{itemID}_.000')/Versions
2
  • Thank you UBK. I am using SP2013 on premises. I'm not sure how to crawl through every item in a list, not just one item.
    – ChasEpes
    Apr 22 '20 at 22:36
  • 1
    Hi, we can look at C# managed client side object model for this task or use PowerShell. It would not be very efficient if done through Web since you will have to loop through all items in a list and then all version for each of those list item and essentially export the data to CSV. Please check this link for the PowerShell script which can help you on your task: gallery.technet.microsoft.com/office/Test-bb3ed1ca , you can find a custom solution as well: archive.codeplex.com/?p=exportversionhistorysp2013
    – UBK
    Apr 22 '20 at 23:31

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.