Deleted documents version history behaviour in SharePoint Document Sets

Someone asked me about why it seems Documents that are deleted from Document Sets are apparently not recoverable from the Document Sets version history.

It is a bit odd at first glance- seems like version history should be version history. The official MS description of how to work with versioning in Document Sets is here:   More on using the “Capture Version” at and

When I add two documents, do a Capture Version, delete one of the documents, and then do a second “Capture Version”, the deleted document is definitely gone:

10-7-2013 9-12-59 AM

When you go to restore that document set, it warns you that the file is gone:


10-7-2013 9-14-09 AM

Essentially this is behavior is “by design” as dealing with document deletes is outside it’s functionality intent. Document Set’s don’t have any special ability to overcome the absence of a document – deletions follow the same recycle bin > delete lifecycle in Document Sets as well.

More on other limitations of document sets here:

I would be surprised if this would ever be changed as out of the box SharePoint behaviour– the core problem would be – if I delete a document, and then it gets run through the first and second stage recycling, it would be most definitely gone- deleted from the SP DB.  So imagine if we made a special exception that if documents were in a Document Set, their version histories would be maintained despite what would normally be a hard delete.

This would make life very confusing for the DB/backup admin as you would essentially have orphaned documents that could never be deleted unless the associated Document Sets were deleted.  I’m not sure how that could all be set up in a sensible way.

As the person asking about this scenario found, you would have to come up with custom code to work around this, or move to a more advanced records management/archive solution. One thing that could be done is to write a feature that fires an event receiver on a document delete even, and then execute the code found at under “Download the Document Set as a .ZIP file”. The idea would be to preserve the documents from deletion by downloading the whole document set at that point in time and storing it somewhere else in SharePoint.

Thanks to Stefaan from Belgium for getting me onto the topic.

Document Management, document sets

Comments (2)

  • Jorge salsamendi

    Hello Keith,y need your help about a sharepoint problem.
    Y have a script to set the formula of a calculated field.
    Certainly y run the script and y take an error were not find the
    column which y add to the formula.
    Here is my code excuse me for my english.
    function Edit-ColumnFormulaToSite


    $ok = $true
    $web = get-SPWeb $SiteUrl
    if ($web)
    $field = $web.Fields | where { $_.InternalName -eq $Name}
    $field2=$web.Fields | where { $_.InternalName -eq $Formula}

    $calculatedfield = $field -as [Microsoft.SharePoint.SPFieldCalculated]
    $field.OutputType = [Microsoft.SharePoint.SPFieldType]::Text;
    $field.Formula = $Formula;
    $field.DefaultFormula = $Formula;

    #$field.DefaultFormula= “=TODAY()”#$Formula

    #$calculatedfield = $field -as [Microsoft.SharePoint.SPFieldCalculated]

    #$calculatedfield.OutputType = [Microsoft.SharePoint.SPFieldType]::Text;

    $field.PushChangesToLists = $true
    write-host “La columna $($Name) no existe!” -ForegroundColor DarkYellow
    $ok = $false
    Write-Host “El sitio ‘$($SiteUrl)’ no existe! `r`n” -ForegroundColor DarkYellow
    $ok = $false

    return $ok

    • Hey Jorge,

      Without having time at the moment to run down the code fully – did you check that the Parameter “Name” that you are feeding this function is actually the internal name of the field? For example, if you are feeding it the Display Name of “My Column“, that won’t match the Internal Name part of $field = $web.Fields | where { $_.InternalName -eq $Name} because the Internal Name for My Column would likely have it’s space characters replaced with _x0020_ e.g. “My_x0020_Column”.

Leave a Reply

Your email address will not be published. Required fields are marked *