none
Append Changes To Existing Text

    Question

  • Hi,

    I have a list with a Description field.  There is a lot of data embedded in the Description field because the setting "Append Changes To Existing Text" is set to Yes on the field.

    When I export to Excel this information does not get exported.

    How do I export this information?

    Thursday, October 15, 2009 12:18 PM

Answers

  • Every time you make an entry into the Description field with "append changes" setting turned on, SharePoint creates a new version of the item.  When you export to Excel, only the latest version is exported so you end up only with the last set of entries in the Description field. 

    The only way to export this data to Excel (or any other format) is programmatically via a Visual Studio application or a Powershell script.  I tested the PowerShell script below on my dev box and it exported the contents of each of the versions of the item to the console.  (You'll have to modify it to output it to a text file or another medium of your choice.)

    HTH

    [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint") > $null
    [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint.Deployment") > $null
    
    
    write-host "Starting script..."
    
    $ListUrl = "http://YOUR_SHAREPOINT_LIST_URL"
    
    # specify your column name here...
    
    $ColumnName = "Description"
    
    $site = new-object Microsoft.SharePoint.SPSite($ListURL)
    
    $web = $site.OpenWeb()
    	
    $list = $web.GetList($ListURL)
    
    foreach ($item in $list.Items)
    {
    
    $DescriptionColumn = ""
    
    foreach ($version in $item.Versions)
    {
    
    $DescriptionColumn = $DescriptionColumn , "; ", $version.ListItem[$ColumnName], " created by ", $version.CreatedBy, " on ", $version.Created 
    
    }
    
    write-host "Item Title: ", $item.Title
    write-host "Description: ", $DescriptionColumn
    
    }
    
    write-host "Job completed."
    

    Andre Galitsky, MCTS, Lexington, KY -- My SharePoint Blog: http://www.sharepointnomad.com
    • Marked as answer by Lily Wu Thursday, October 22, 2009 12:33 AM
    Friday, October 16, 2009 9:51 PM

All replies

  • Every time you make an entry into the Description field with "append changes" setting turned on, SharePoint creates a new version of the item.  When you export to Excel, only the latest version is exported so you end up only with the last set of entries in the Description field. 

    The only way to export this data to Excel (or any other format) is programmatically via a Visual Studio application or a Powershell script.  I tested the PowerShell script below on my dev box and it exported the contents of each of the versions of the item to the console.  (You'll have to modify it to output it to a text file or another medium of your choice.)

    HTH

    [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint") > $null
    [System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint.Deployment") > $null
    
    
    write-host "Starting script..."
    
    $ListUrl = "http://YOUR_SHAREPOINT_LIST_URL"
    
    # specify your column name here...
    
    $ColumnName = "Description"
    
    $site = new-object Microsoft.SharePoint.SPSite($ListURL)
    
    $web = $site.OpenWeb()
    	
    $list = $web.GetList($ListURL)
    
    foreach ($item in $list.Items)
    {
    
    $DescriptionColumn = ""
    
    foreach ($version in $item.Versions)
    {
    
    $DescriptionColumn = $DescriptionColumn , "; ", $version.ListItem[$ColumnName], " created by ", $version.CreatedBy, " on ", $version.Created 
    
    }
    
    write-host "Item Title: ", $item.Title
    write-host "Description: ", $DescriptionColumn
    
    }
    
    write-host "Job completed."
    

    Andre Galitsky, MCTS, Lexington, KY -- My SharePoint Blog: http://www.sharepointnomad.com
    • Marked as answer by Lily Wu Thursday, October 22, 2009 12:33 AM
    Friday, October 16, 2009 9:51 PM
  • Thanks Andre.  It is good to get some clarification on this.

    I will try the Powershell solution.
    • Marked as answer by Lily Wu Thursday, October 22, 2009 12:33 AM
    • Unmarked as answer by Lambert Qin [秦磊] Wednesday, December 16, 2009 5:53 AM
    Saturday, October 17, 2009 8:39 PM
  • Hi Andre,

    I have tried to use your solution to export to a CSV file but am only able to get the last entry made. Are you able to provide somemore information around exporting a 'append changes' column.

    Thanks for your time.

    Tuesday, May 08, 2012 10:06 AM
  • I've been able to do this using C# within Visual Studio.   There is a mistake in the code above though :

    foreach ($version in $item.Versions)
    {
       $DescriptionColumn = $DescriptionColumn , "; ", $version.ListItem[$ColumnName], " created by ", $version.CreatedBy, " on ", $version.Created 
    }
    

    This is using the $VERSION object - and then going to get the parent LISTITEM - and so it'll only be the latest descrtiption...

    It should be this :

    foreach ($version in $item.Versions)
    {
       $DescriptionColumn = $DescriptionColumn , "; ", $version[$ColumnName], " created by ", $version.CreatedBy, " on ", $version.Created 
    }
    

    Friday, May 25, 2012 12:50 AM
  • Was anyone able to get this data copied to another column?
    Tuesday, August 05, 2014 7:19 PM