When working with document sets, I'm running in to the following problem. I'll try to be as specific as I can be:

  1. I've created a library
  2. Within this library I create a custom view (which has a group by on the documents).
  3. Then I set the default view of the library on 'All documents'

So far so good, but now for the tricky part:

  1. Within this library I add a content type which is based upon a document set
  2. I configure the document set, so that has a default view, which is the one I created in step 2.

So now you have 2 different working views: 1, The All documents view on the library and 2. The custom view within de document set.

  1. Within the library I create a new document set based on this content type
  2. Now I create a second libary, which, in it's configuration, is a exact copy of the library I've created in step 1

Now comes the trouble!

  1. Through Content and structure, I copy the document set from step 5, to the library I've created in step 6.
  2. When this is done, I go to the library where the copy of the document set exists. However: When I enter de document set, the custom view that was the default view for the document set, is somehow replaced bij de default view (All documents) from the library itself.

Can someone please explain this behavior to me? Am I doing something wrong, or is SharePoint playing one of it's Jedi mindgames?

1 Answer 1


I moved some document sets with PowerShell and I didn't have the same issues that you have encounterd. So this might help you!

$moveFromUrl = "Url"
$moveToUrl = "Url"
$moveItemName = "Document Set Name"
function checkItemToMove ([Microsoft.SharePoint.SPList]$movefromList, [string]$moveToUrl, [string]$moveItemName)
    $docsetID = [Microsoft.SharePoint.SPBuiltInContentTypeId]::DocumentSet
    [Microsoft.SharePoint.SPFolder]$docsetToMove = $null 

$docSetListItem = $movefromList.Items | where {$_['Title'] -eq $moveItemName}
$docSetToMove = $docSetListItem.Folder
$docsetContentTypeId = $docSetListItem.ContentType.Parent.Id

if($docsetToMove -ne $null -and $docsetContentTypeId -ne $null -and $docsetContentTypeId.ToString().StartsWith($docsetID.ToString())) 
    Write-Host -ForegroundColor Green "Found a docset: " $docsetToMove.Name " Lets move it"
    moveDocSet $docsetToMove $moveToUrl $docsetContentTypeId
    Write-Host -ForegroundColor Red "no document set of desired name found:" $moveItemName 

function moveDocSet ([Microsoft.SharePoint.SPFolder]$docset, [string]$moveToUrl, [string]$docsetContentTypeId)
$url = $moveToUrl + $docset.Name

[Microsoft.SharePoint.SPList]$moveToList = $site.OpenWeb().GetList($moveToUrl)
$newDocSetItem = $moveToList.Items | where {$_['Name'] -eq $docset.Name}
$newDocSet = $newDocSetItem.Folder

$newDocset.Item["ContentTypeId"] = $docsetContentTypeId
$newDocset.Item["HTML File Type"] = "SharePoint.DocumentSet" 

Write-Host -ForegroundColor Green " Document set moved succesfully "
else {Write-Host -ForegroundColor Red " Failed moving the docset or setting ... "}

if($moveFromUrl -eq $null -or $moveFromUrl -eq "") {Write-Host -ForegroundColor Red "No folder to move from"; Exit}
if($moveToUrl -eq $null -or $moveToUrl -eq "") {Write-Host -ForegroundColor Red "No folder to move to"; Exit}
if($moveItemName -eq $null -or $moveItem -eq "") {Write-Host -ForegroundColor Red "No DocumentSet name set"; Exit}

$site=new-object Microsoft.SharePoint.SPSite($moveFromUrl)


checkItemToMove $movefromList $moveToUrl $moveItemName 
  • Thank you for your quick answer George, I've considered using powershell for this, but the problem is that we want to make this available for our end users. So the question is: Is it possible to make the powershellscript work behind a button (or something equal) on the teamsite. In a way that the end user can start this script themselves. Commented Oct 9, 2013 at 13:42
  • Not rly sure of this but in my mind, it would be possible to make this functionality as C# code and upload it as a WebPart(button)! Commented Oct 9, 2013 at 13:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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