How to get Document Version with “Export to Excel” from SharePoint

You may have come across the same disappointment as I did when trying to get the version of document while output it to Excel – i.e. the version column does not get exported.

The post below goes through a technique for allowing you to capture the version history.

This post has several gotcha’s regarding pages of data.

    • You can only export 1 page of data at a time.  If your browser session has a view with the default (30 rows) of data, following the technique in the blog post above will get you 30 results, with the rest as N/A’s
    • You can create a new view with up to 200 rows, and get that many rows of data output
    • If you need more than 200 rows of data (say you have 1000 rows you need to get) you can edit this line in the attached code as follows.
      • Original
        sGet = sListWeb & "/owssvr.dll?Cmd=Display&List=" _
        & sListGUID & "&View=" & sViewGUID & "&XMLDATA=TRUE&dt=" & Now
      • Edited (example)
        sGet = sListWeb & "/owssvr.dll?Cmd=Display&List=" _
        & sListGUID & "&View=" & sViewGUID & "&Paged=TRUE&p_ID=3684&PageFirstRow=101&XMLDATA=TRUE&dt=" & Now
      • Some combination of the above 3 URL attributes should begin to get you results for the 2nd, 3rd, etc. pages.  Be aware, the p_ID attribute is unique for the first item of each new page, so this will have to change with each page (in other words, you’ll have to get the results in the browser, and then rerun the VB script again for pages 2, 3, 4, etc.)
    • Alternatively, you can follow the advice of one commenter and try this below.
      • Either you parameter the number of rows displayed on the page via the “Items Limit” feature (when you create the view) or you force &XMLDATA with the value “1&RowLimit=0” in the query.