5

Okay, here is what I'm able to do:

  1. Export a list from SharePoint to excel.

  2. View an individual item's version history within the online SharePoint.

What I am trying to do is export this version history along with the list itself. Ideally, the versions would be on adjacent rows like this:

 - Item 1, Version 1.0
 - Item 1, Version 2.0
 - Item 2, Version 1.0

I have not found a straight forward solution to this on stack exchange or by searching Google yet.

Thank you for any assistance in the matter!

1
  • I saved the XML file after adding &IncludeVerions=True to the URL in the browser but when I save the owssvr file, it is empty.
    – user91663
    Commented Jul 5, 2020 at 22:47

3 Answers 3

6

Check this workaround

  • Use the Export to Excel option in the List section of the ribbon
  • Save the owssvr.iqy file and open with notepad
  • Copy just the URL from the file and paste it back into your browser,
http://your site/_vti_bin/owssvr.dll?XMLDATA=1&List={74672F3E-D0D8-43DD-8CEC-4788C91A5F3F}&View={02455BAA-DC40-49D7-A414-3930B4DD905D}&RowLimit=0&RootFolder=%2fworkflow%2fLists%2ftest

enter image description here

  • adding "&IncludeVersions=TRUE" to be like this
http://your site/_vti_bin/owssvr.dll?XMLDATA=1&List={74672F3E-D0D8-43DD-8CEC-4788C91A5F3F}&View={02455BAA-DC40-49D7-A414-3930B4DD905D}&RowLimit=0&RootFolder=%2fworkflow%2fLists%2ftest&IncludeVersions=TRUE
  • Save the XML file and open in Excel (or your favorite XML viewer), selecting the "As an XML table" open option.
  • You'll have to delete the first few columns and rows as they contain the schema data but other than that you should have all the version history (I suggest you add the Version column to the view)

Ref

You can use the following power shell to export version to list

# ******* Variables Section ******************
#Define these variables
$WebURL="http://sharepoint.crescent.com/sites/Sales/"
$ListName ="Invoice"
$ReportFile = "D:\Invoice_VersionHistory.csv"
# *********************************************

#delete file if exists
If (Test-Path $ReportFile)
 {
 Remove-Item $ReportFile
 }

#Get the Web and List
$Web = Get-SPWeb $WebURL
$List = $web.Lists.TryGetList($ListName)

 #Check if list exists
 if($List -ne $null)
 {
  #Get all list items
  $ItemsColl = $List.Items

  #Write Report Header
  Add-Content -Path $ReportFile -Value "Item ID, Version Lable, Created by, Created at, Title"

  #Loop through each item
  foreach ($item in $ItemsColl)
  {
   #Iterate each version
      foreach($version in $item.Versions)
       {
    #Get the version content
    $VersionData = "$($item.id), $($version.VersionLabel), $($version.CreatedBy.User.DisplayName), $($version.Created), $($version['Title'])"
    #Write to report
    Add-Content -Path $ReportFile -Value $VersionData
   }
  }
 }
Write-Host "Version history has been exported successfully!"

Ref

You can also use this solution at code plex

https://exportversionhistorysp2013.codeplex.com/

2
  • So, I have taken the steps to save the XML and open it in excel. I found that it only gives me the schema rows + the list rows. These rows are not different from what I would export normally to excel without the IncludeVersions=True step. I can see that some of the items have different major versions, so I know versioning is enabled. Are there perhaps multiple levels to enabling versioning? Have I not fully enabled it? Also, is the URL parameter method equivalent to the powershell method or are these intended to be taken one after another?
    – gmallory
    Commented Aug 9, 2016 at 12:53
0

I want to add idea to the solution from @Mohamed El-Qassas MVP

You can add url to a .iqy file (the same as default "Export to Excel" functionality). File should contain the next data:

WEB
1
http://your site/_vti_bin/owssvr.dll?XMLDATA=1&List={74672F3E-D0D8-43DD-8CEC-4788C91A5F3F}&View={02455BAA-DC40-49D7-A414-3930B4DD905D}&RowLimit=0&RootFolder=%2fworkflow%2fLists%2ftest&IncludeVersions=TRUE

It is not formatted, but it is better then XML and works like out of the box button.

1
  • I can't see version column exported in the excel file .
    – Ali
    Commented May 10, 2021 at 2:43
0

You can combine that with XML import:

Sub DownloadVH()
ActiveWorkbook.XmlImport Url:="http://yourSite/_vti_bin/owssvr.dll?XMLDATA=1&List={74672F3E-D0D8-43DD-8CEC-4788C91A5F3F}&View={02455BAA-DC40-49D7-A414-3930B4DD905D}&RowLimit=0&RootFolder=%2fworkflow%2fLists%2ftest&IncludeVersions=TRUE", ImportMap:=Nothing, Overwrite:=True, Destination:=Range("Data!A1")

End Sub

Not the answer you're looking for? Browse other questions tagged or ask your own question.